browserDocumentLoadComplete working correctly?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
Hi all,

no idea if this is a bug or feature:
When I use the message "browserDocumentLoadComplete"
this does not work correctly when dealing with "dynamically created pages"
(no idea if that is the correct term?).

-> put url "http://www.whatever.com/anything" into aVariable
does not work in these cases!

I set a custom property to the sourcecode of a browser object with some tricks
that Hermann generously told me ->on browserDocumentLoadComplete

But when the message fires, the CP is EMPTY and I have to wait a little longer until
the sourcecode is actually stored in that CP.

My question:
Is that correct behaviour of the "browserDocumentLoadComplete" message?


Best

Klaus
--
Klaus Major
https://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
to me it seems like a nope.

I would think that this is an issue with the browser widget not being able
to detect when the page is completely "rendered" .... which is not the same
as being completely "loaded".....

as soon as I noticed that this message does not work consistently, I gave
up on using it ...so I did not further investigate the reasons for this.

On Wed, Nov 20, 2019 at 12:50 PM Klaus major-k via use-livecode <
[hidden email]> wrote:

> Hi all,
>
> no idea if this is a bug or feature:
> When I use the message "browserDocumentLoadComplete"
> this does not work correctly when dealing with "dynamically created pages"
> (no idea if that is the correct term?).
>
> -> put url "http://www.whatever.com/anything" into aVariable
> does not work in these cases!
>
> I set a custom property to the sourcecode of a browser object with some
> tricks
> that Hermann generously told me ->on browserDocumentLoadComplete
>
> But when the message fires, the CP is EMPTY and I have to wait a little
> longer until
> the sourcecode is actually stored in that CP.
>
> My question:
> Is that correct behaviour of the "browserDocumentLoadComplete" message?
>
>
> Best
>
> Klaus
> --
> Klaus Major
> https://www.major-k.de
> [hidden email]
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


--
Tom Glod
Founder & Developer
MakeShyft R.D.A (www.makeshyft.com)
Office:226-706-9339
Mobile:226-706-9793
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
Hi Tom

> Am 20.11.2019 um 19:43 schrieb Tom Glod via use-livecode <[hidden email]>:
>
> to me it seems like a nope.
>
> I would think that this is an issue with the browser widget not being able
> to detect when the page is completely "rendered" .... which is not the same
> as being completely "loaded".....
>
> as soon as I noticed that this message does not work consistently, I gave
> up on using it ...so I did not further investigate the reasons for this.

OK, I see, maybe CURL, this is for a Mac app, can do this?

If yes, how to call CURL:
curl --url "url here..."
will only return what "put url xxx into aVariable" does, show incomplete data.

Any hints very welcome!

> On Wed, Nov 20, 2019 at 12:50 PM Klaus major-k via use-livecode <
> [hidden email]> wrote:
>
>> Hi all,
>>
>> no idea if this is a bug or feature:
>> When I use the message "browserDocumentLoadComplete"
>> this does not work correctly when dealing with "dynamically created pages"
>> (no idea if that is the correct term?).
>>
>> -> put url "http://www.whatever.com/anything" into aVariable
>> does not work in these cases!
>>
>> I set a custom property to the sourcecode of a browser object with some
>> tricks
>> that Hermann generously told me ->on browserDocumentLoadComplete
>>
>> But when the message fires, the CP is EMPTY and I have to wait a little
>> longer until
>> the sourcecode is actually stored in that CP.
>>
>> My question:
>> Is that correct behaviour of the "browserDocumentLoadComplete" message?

Best

Klaus

--
Klaus Major
https://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Yes, browserDocumentLoadComplete is working correctly and consistent
with HTML5, no bug here.

BrowserDocumentLoadComplete is fired as soon as the DOM is finished
incl. *reading* your script tags.
*After* that your javascript is *executed*. The server and browser/
browser widget don't check/care what you will execute in that page
after loading the instructions. How should they know that?

Nevertheless this is OK for short jobs, but if you are loading from
a slow server or are loading large images and/or apply a time
consuming javascript then you have to add some "waiting time",
usually up to one second is long enough.

There is only one "full" remedy I can see: An own JavaScript handler.

One way to know exactly when you are done is to use an "async"
function in onload so that you can "await" that certain jobs are done
and then send a callback via a javascriptHandler to LC.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
Hi Hermann,

> Am 20.11.2019 um 22:13 schrieb hh via use-livecode <[hidden email]>:
>
> Yes, browserDocumentLoadComplete is working correctly and consistent
> with HTML5, no bug here.
> BrowserDocumentLoadComplete is fired as soon as the DOM is finished
> incl. *reading* your script tags.

ah, I see, thanks for the clarification!

> *After* that your javascript is *executed*. The server and browser/
> browser widget don't check/care what you will execute in that page
> after loading the instructions. How should they know that?

Hm, clairvoyance? 8-)
Yes, get it!

> Nevertheless this is OK for short jobs, but if you are loading from
> a slow server or are loading large images and/or apply a time
> consuming javascript then you have to add some "waiting time",
> usually up to one second is long enough.

Yes, I am already using your tricks, thanks again, but speed is
important for my project, since I will need to load up to 20-30
(maybe more later) pages and extract hte data in a specific TABLE
from the sourcecode.

> There is only one "full" remedy I can see: An own JavaScript handler.
>
> One way to know exactly when you are done is to use an "async"
> function in onload so that you can "await" that certain jobs are done
> and then send a callback via a javascriptHandler to LC.

That requires access to the html-file, right?
Or can I "inject" something like that on-the-fly?
If yes, how should it look like?

Sorry, still a complete newbie in JavaScript...


Best

Klaus
--
Klaus Major
https://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Klaus,

looked in the scenario you mention. (I didn't say to use
messages of the browser widget ...)

This is your scenario (correct me if not):

You have several pages on one or more foreign servers.
These pages have dynamically generated content you wish
to access and extract parts to custom properties.

We need a solution that you can adjust yourself without
knowing JavaScript.

As you need a browser widget, several more use the same
widget code, so they are no additional burden in size.

You could try the following:

Use the javascriptHandler JS I told you with an additional
parameter (identifying the page) in the card script.
Load each page you need in a separate (invisible) browser
widget, using a short wait for the LC callback with that
javaScriptHandler.

In the handler JS you can check ALL incoming pages for
having the content you wish to read, also with a "send in
time" loop (say 500 millisecs intervals) for a retry.

Then you can even build and update your display page with
a "waiting for <page>" for the parts that are not yet ready.

A problem with that method could be that the server doesn't
allow too many multiple connections from the same IP. Then
one has to do the method in pieces with an allowed number
of connections.

For more detailed questions contact me via email. This may
be too special for the list, especially as you may be not
allowed to publish too much details.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: browserDocumentLoadComplete working correctly?

Mark Wieder via use-livecode
Hallo Hermann,

> Am 21.11.2019 um 09:52 schrieb hh via use-livecode <[hidden email]>:
>
> Klaus,
>
> looked in the scenario you mention. (I didn't say to use
> messages of the browser widget ...)

I did not say you did so, just rying out some things! :-)

> This is your scenario (correct me if not):
>
> You have several pages on one or more foreign servers.
> ...
> For more detailed questions contact me via email. This may
> be too special for the list, especially as you may be not
> allowed to publish too much details.

Thank you very much, will send you a private mail later.


Best

Klaus

--
Klaus Major
https://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode