Browser HTML Source & URLs

hakan at exformedia.se hakan at exformedia.se
Wed Apr 17 07:24:48 EDT 2019


You can execute a small javascript to grab the HTML. I’ve done something similar in an Instagram Scraper I just built….

First you need to set up a callback function in the widget under javascript handlers e.g. jscallback then you can call a javascript that calls you back with whatever you want. Create field for the script, save script into a constant or just submit if it is short:

do ”liveCode.jscallback( ’source', document.documentElement.outerHTML );" in widget ”browser"

You also need to setup the jscallback in LiveCode:

on jscallback pMethod pValue
 if pMethod is ”source” then
      # pValue holds the source except the <!doctype>
   end if
end jsCallback

Here I used a ”key value” principle with a method and a value, but you can of course set up several callbacks in the browser widget if you prefer.

Håkan
PS. Writing code directly in mail so it is untested and qoutes and formatting might be wrong...
On 16 Apr 2019, 16:53 +0200, Rick Harrison via use-livecode <use-livecode at lists.runrev.com>, wrote:
> I am able to load the browser widget with a URL
> and go to the URL successfully.
>
> I can get the HTMLtext of the page I have
> browsed to just fine.
>
> What I have yet to do is to get the page
> source code of the page I have browsed
> to in LiveCode into a field.
>
> I also would like the browser widget to
> show me any new URL address that I
> have gone to.
>
> Suggestions?
>
> Thanks,
>
> Rick
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list