revBrowser: two questions

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

revBrowser: two questions

Post by ale870 » Mon Mar 08, 2010 12:25 pm

Hello,

I'm successfully using revBrowser in Ms Windows, but I have a some of questions:

1) How can I get Internet Explorer browser version? It could be useful, since my program should run over several computers (IE 6, IE 7, etc...)

2) Sometimes I get "script error in page": this is a typical error message sent by IE if javascript is not correct. How can I suppress that error (I do not get such error if I navigate in the same pages using IE browser standalone).

3) From my RunRev application I can call script fuctions contained in a web page. Well, can I intercept a javascript function call (called inside javascript self)? I need to detect, from RunRev, when javascript call a specific function: is it possible? As workaround, I use a special web procol (invented by me!) and I trap http call, but I prefer to intercept javascript call.

4) I say again that "browserCancel" global variable to stop browsing DOES NOT WORK (I already opened another topic about this, but no RunRev admin got me an answer).

thank you for your help!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki

dickey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Wed Apr 08, 2009 11:54 pm
Location: Shellharbour, Australia

Re: revBrowser: two questions

Post by dickey » Thu Mar 11, 2010 6:17 am

Hello ale870,

I noticed no one has attempted to answer your post (and given I am using revBrowser a lot at present), I thought I might try to answer your questions.

1. the revBrowser library does not offer a call to determine the browser version, probably as it assumes it sufficient to state that using revBrowser on Mac uses Safari, and on Windows Internet Explorer.
As it can be necessary to know the browser version, it may be necessary to use one of several workarounds.

I assume you are concentrating on Windows for now

1.1 you can find out the version of IE via batch file run at the cmd line. You can implement this easily enough from RunRev. See http://www.windowsitpro.com/article/jsi ... lled-.aspx for an example of the batch file commands to run from the cmd line. For some examples of using the command line from within Run Rev see my previous post http://forums.runrev.com/phpBB2/viewtop ... 093#p18093.

1.2 if you have access to a web server this may be neater for you. You can establish a web page and using PHP as an example create a page like:

Code: Select all

<?php
  echo $_SERVER['HTTP_USER_AGENT'];
?>
, then before you display your rev browser object by setting it's rect property (ie. whilst it is not visible), you navigate to your php page (which detects browser version), and use

Code: Select all

put revBrowserGet(tBrowserId, "htmltext") into tBrowserVersion
or similar to record and interpret the browser version. I am current using this method.


2. several thoughts, a) some web pages detect window size and respond badly when you implement the browser in a small window, b) the javascript or debugging options in the browser can cause verbose or detailing error messaging, c) do you have revBrowserSet tBrowserId, "messages", "http://www.somepage.com" set to true as this may (prob wrong) trigger more verbose error msgs. d) have a look at whether the error laden pages use browser plug-ins or other frameworks for clues.

3. you can certainly run javascript which may or may not include calls to functions that exist in the source of the web page with code like:

Code: Select all

  get revBrowserExecuteScript(tBrowserId, "document.form1.txtSuburb.value = 'Miranda';")
  --or
  get revBrowserExecuteScript(tBrowserId, "document.getElementById('btnSearch').click();")
and you can control the timing of their execution, however beyond that I am unsure of what you are attempting to determine with a listener as javascript (ajax calls aside) is run client side.

4. revBrowserStop tBrowserId stops loading the current page, and if that is not sufficient I then hide or close the browser object.

I hope this helps a little.

Kind regards, Andrew

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Re: revBrowser: two questions

Post by ale870 » Thu Mar 11, 2010 10:26 am

Thank you for your reply.
I made some tests more, and I found some interesting (positive) results:

1) Good idea! I will implement something similar using my servers java and newLisp :-), even if the problem is not completely solved since one can "modify" the browser behavior to appear as another browser type.

2) It seems the new RunRev version, 4.5-dp2, will eliminate this problem! In fact I made some tests using this new beta-version, and the problem does not appear any more.

3) About this point: I know (and used!) that function - revBrowserExecuteScript() - but I needed to do the opposite: I want to write a javascript function that, once it is executed, it is "trapped" by RunRev. In this way I can create a complete javascript class that "talks" with my RunRev browser.

4) This is a bug of version 4.0 (see Bugzilla for more info). I can confirm that this problem was solved in the new version 4.5-dp2 :-) I think RunRev guys are working so much to make a very good RunRev version 4.5!!!

Thank you again to you for your hints, and thank you to RunRev guys for the next-coming 4.5: it seems a great improvement for the community!!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki

karmacomposer
Posts: 256
Joined: Wed Apr 27, 2011 2:12 pm

Re: revBrowser: two questions

Post by karmacomposer » Tue Feb 21, 2012 4:48 am

If I may ask a question regarding revBrowser:

How would I embed a internet browser in a card? I want to have a physical internet browser window embedded in a card so a user can click on a button and go to a specific web page (in this case, it would load in a .mov file on my server, which is password protected, and then play the video.) I also want to do this for a adobe acrobat manual - the user presses a chapter button and the appropriate chapter loads into the embedded internet control.

How would I do this in Live Code? I have v5.0.2

Mike

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Re: revBrowser: two questions

Post by ale870 » Tue Feb 21, 2012 8:21 am

revBrowser is "funny": you link it to a window (stack) but the messages are directed to a card :-)
Currently I open a revBrowser instance per stack. in order to make a tabbed browser style I don't know if is feasible.
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki

AndyP
Posts: 418
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: revBrowser: two questions

Post by AndyP » Tue Feb 21, 2012 8:42 am

RunRev have a sample browser stack here: http://runrev.com/developers/lessons-an ... r-sampler/
which may help.
Andy Piddock

http://2108.co.uk/tinyide/ - Mini LC IDE alternative

http://2108.co.uk/script-editor-themer/ - Script Editor colour theming

http://livecodeshare.runrev.com/stack/897/LiveCode-Multi-Search - Search across 8 LC resources

karmacomposer
Posts: 256
Joined: Wed Apr 27, 2011 2:12 pm

Re: revBrowser: two questions

Post by karmacomposer » Tue Feb 21, 2012 2:52 pm

I have studied the revBrowser example stack - it does not help me since it calls a card that instantiates a full screen browser - I need to embed one in a control or scroll box or something.

Mike

Klaus
Posts: 11009
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: revBrowser: two questions

Post by Klaus » Tue Feb 21, 2012 3:15 pm

Hi Mike,

you can set the rect of the browser overlay to whatever you need!
Or am I missing something?


Best

Klaus

karmacomposer
Posts: 256
Joined: Wed Apr 27, 2011 2:12 pm

Re: revBrowser: two questions

Post by karmacomposer » Tue Feb 21, 2012 9:05 pm

In the example, it's not an overlay - it calls another sub-stack that uses the entire window (nothing to use the rect command on) - unless I am missing something???

Mike

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: revBrowser: two questions

Post by sturgis » Wed Feb 22, 2012 12:48 am

The browser sample does use an overlay. Its just a stack with buttons as controls, and a revbrowser instance.

When it is open if you type the following into the msg box
revbrowserinstances() it will show you the instance number of the browser.

Then if you "revbrowserset #,"rect","150,150,300,300" --# indicates the number you got from revbrowserinstances()

the browser will resize and relocate based on the numbers you set it to.

The controls, address box, etc are just that. Buttons and fields that have code to interact with the revbrowser instance. If you look at the card script for that stack you can see how it does all its things.

For a tabbed set up same stack, you can start multiple revbrowser instances and show or hide them as needed. revbrowserset browserinstance,"visible",true -- or false to hide
karmacomposer wrote:In the example, it's not an overlay - it calls another sub-stack that uses the entire window (nothing to use the rect command on) - unless I am missing something???

Mike

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”