Page 2 of 2
Re: BrowserControl with scriptable web console?
Posted: Fri Feb 21, 2014 5:17 pm
by Klaus
HI Esso,
well, sometimes it takes some time until I "get" it
But once I got it, he he he!
Best
Klaus
Re: BrowserControl with scriptable web console?
Posted: Fri Feb 21, 2014 10:20 pm
by EssoAir
Klaus wrote:HI Esso,
well, sometimes it takes some time until I "get" it
But once I got it, he he he!
Best
Klaus
What is sBrowserId?
the example from the doc is
get revBrowserExecuteScript(sBrowserId, "alert('This is a debugging message');"
get revBrowserExecuteScript(sBrowserId, the text of field "JavaScript" of me)
sorry is this is obvious but I'm not that good with livecode. I'm more of the web-development type
Re: BrowserControl with scriptable web console?
Posted: Sat Feb 22, 2014 1:11 pm
by Klaus
Hi Esso,
when you open a (new instance of the) browser control, which is in fact an OVERLAY on top of your stack,
you will get an ID, that you can later use to manage that namely browser instance:
Code: Select all
...
## Make this variable LOCAL or GLOBAL, depending on where you put all your revBrwoser..." scripts:
global sBrowserID
## 1. You need to supply a window ID, where the browser instance will "stick" to:
put the windowid of this stack into tWID
## 2. Open instance and store its ID for later use!
put revBrowserOpen(tWID,"http://www.server.com/page.html") into sBrowserID
## 3. Check for possible errors, ID MUST be an integer on success:
if sBrowserID is not an integer then
answer "Problems openeing browser:" && sBrowserID
exit to top
end if
## 4.
## Now you need to set some properties of the browser to position the window and SHOW it:
## I ususally use a HIDDEN graphic as a placeholder for the RECT of my browser
put the rect of grc "the hidden placeholder for the browser" into tRect
revBrowserSet sBrowserID, "rect", tRect
revBrowserSet sBrowserID, "visible", TRUE
### etc. check all "revBrowser..." commands and functions in the dictionary.
...
That are the basic commands to open a browserinstance on top of the current card.
And DONT forget to add a button somewhere to close the browser!
...
revBrowserClose sBrowserID
...
Best
Klaus
Re: BrowserControl with scriptable web console?
Posted: Sat Feb 22, 2014 3:25 pm
by EssoAir
Thank you! I got it working but sadly now it won't run my JS even though it works perfectly in Chrome, Safari and Firefox

Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 2:11 am
by EssoAir
Klaus wrote:Hi Esso,
when you open a (new instance of the) browser control, which is in fact an OVERLAY on top of your stack,
you will get an ID, that you can later use to manage that namely browser instance:
Code: Select all
...
## Make this variable LOCAL or GLOBAL, depending on where you put all your revBrwoser..." scripts:
global sBrowserID
## 1. You need to supply a window ID, where the browser instance will "stick" to:
put the windowid of this stack into tWID
## 2. Open instance and store its ID for later use!
put revBrowserOpen(tWID,"http://www.server.com/page.html") into sBrowserID
## 3. Check for possible errors, ID MUST be an integer on success:
if sBrowserID is not an integer then
answer "Problems openeing browser:" && sBrowserID
exit to top
end if
## 4.
## Now you need to set some properties of the browser to position the window and SHOW it:
## I ususally use a HIDDEN graphic as a placeholder for the RECT of my browser
put the rect of grc "the hidden placeholder for the browser" into tRect
revBrowserSet sBrowserID, "rect", tRect
revBrowserSet sBrowserID, "visible", TRUE
### etc. check all "revBrowser..." commands and functions in the dictionary.
...
That are the basic commands to open a browserinstance on top of the current card.
And DONT forget to add a button somewhere to close the browser!
...
revBrowserClose sBrowserID
...
Best
Klaus
I made a feature request, but its a really simple one that should be quite easy to implement but im afraid that it might get overlooked. Klaus, can you add the ability to use browserDocumentComplete on mobile? It works great on desktops but its not available on mobile.
Thanks!
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 7:31 am
by jacque
EssoAir wrote:
I made a feature request, but its a really simple one that should be quite easy to implement but im afraid that it might get overlooked. Klaus, can you add the ability to use browserDocumentComplete on mobile? It works great on desktops but its not available on mobile.
Have you looked at browserFinishedLoading?
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 2:28 pm
by EssoAir
jacque wrote:EssoAir wrote:
I made a feature request, but its a really simple one that should be quite easy to implement but im afraid that it might get overlooked. Klaus, can you add the ability to use browserDocumentComplete on mobile? It works great on desktops but its not available on mobile.
Have you looked at browserFinishedLoading?
THANK YOU! I completely missed that
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 2:39 pm
by Klaus
Hi Esso,
EssoAir wrote:Klaus, can you add the ability to use browserDocumentComplete on mobile?
I wish I could! It may surprise you, but I am just a user of Livecode and not employed at or related to RunRev in any way.
Best
Klaus
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 3:38 pm
by EssoAir
Klaus wrote:Hi Esso,
EssoAir wrote:Klaus, can you add the ability to use browserDocumentComplete on mobile?
I wish I could! It may surprise you, but I am just a user of Livecode and not employed at or related to RunRev in any way.
Best
Klaus
Well since you're good with livecode, can yo help me figure out how to use " mobileControlCreate 'browser' " on a desktop?
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 4:07 pm
by Klaus
Hi Esso,
see my script above, does exactly what you want!
"revBrowser" is the "desktop equivalent" for -> mobilecontrolcreate "browser"...
Best
Klaus
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 4:17 pm
by EssoAir
Klaus wrote:Hi Esso,
see my script above, does exactly what you want!
"revBrowser" is the "desktop equivalent" for -> mobilecontrolcreate "browser"...
Best
Klaus
do I have to make different .livecode files for desktop and mobile?
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 4:25 pm
by Klaus
HI Ess,.
EssoAir wrote:do I have to make different .livecode files for desktop and mobile?
not neccessarily!
You can check "the environment" and act accordingly, something like this:
Code: Select all
on opencard
## or whenever
## We are on iOS or Android
if the environment = "mobile" then
mobilecontrolcreate "browser"...
## More mobile stuff...
else
## Desktop:
put revBrowseropen(...)
## More desktop stuff...
end if
end opencard
You get the picture
And maybe take a look at this stack:
http://livecodeshare.runrev.com/stack/7 ... er-Sampler
Best
Klaus
Re: BrowserControl with scriptable web console?
Posted: Wed Feb 26, 2014 6:30 pm
by EssoAir
Klaus wrote:HI Ess,.
EssoAir wrote:do I have to make different .livecode files for desktop and mobile?
not neccessarily!
You can check "the environment" and act accordingly, something like this:
Code: Select all
on opencard
## or whenever
## We are on iOS or Android
if the environment = "mobile" then
mobilecontrolcreate "browser"...
## More mobile stuff...
else
## Desktop:
put revBrowseropen(...)
## More desktop stuff...
end if
end opencard
You get the picture
And maybe take a look at this stack:
http://livecodeshare.runrev.com/stack/7 ... er-Sampler
Best
Klaus
Wow lots of code! Ill take a closer look when i get home. I cant run LiveCode on my iPad so i cant do it at school :/