revBrowserCEF - Handle New Window/Tab Request

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Steve Collins
Posts: 47
Joined: Thu Jan 10, 2008 7:15 am
Location: Redondo Beach, CA
Contact:

revBrowserCEF - Handle New Window/Tab Request

Post by Steve Collins » Mon Mar 28, 2016 12:50 am

I need to serve up this link in an LC browser: http://viewer.zmags.com/publication/bc1cdb39. Several of the buttons in the top center do not work within LC's browser, because they launch a new page/tab. Ideally, I would handle the new page requests by seeing messages and launching the new URLs in a default browser outside of LC. (There is a confirmed bug with revBrowser loading this page, and others like it, in Mac, so I'm using revBrowserCef).

Code: Select all

   revBrowserSet the altBrowserId of this stack, "newwindow", true 
Setting the above to TRUE will allow the buttons to open a new browser window to serve up the second URL. But that opens an LC browser window that looks like a new stack and has no window ID or stack ID of its own, so you can't close, move or change the window by script. Surprisingly, its created in a reasonable size, which shape and size are not shared with any other windows. I think the default window is 0,0,0,0, so something is guiding it. RevBrowserInstances() returns one ID even thought both browser windows are open and functioning. When each window is selected separately, their ID results are the same number.

The browserBeforeNavigate message is sent only when "newwindow" above is set to TRUE. I can get the URL of the new page from the browserBeforeNavigate handler and launch it in an external browser, but not without first getting that initial un-scriptable browser window. There are no visible messages sent before the initial browser window is created and none after browserBeforeNavigate, although it looks like there should be plenty.

Code: Select all

revBrowserSet the altBrowserId of this stack, "messages", true"
Above is set to TRUE in hopes of seeing more messages like browserBeforeNavigate. None of these messages show up on Mac with or without "newwindow" set to TRUE:

on browserNewUrlWindow pInstanceId, pUrl
on browserNewInstance pInstanceId
on browserDocumentFailedFrame pInstanceId, pUrl, pErrorMessage
on browserDocumentFailed pInstanceId, pUrl, pErrorMessage
on browserOut pInstanceId, pElementId
on browserOver pInstanceId, pElementId
browserOver -- may not show up due to no object name, but HTML looks like there is an ID (id="div_21")
browserOut -- may not show up due to no object name, but HTML looks like there is an ID (id="div_21")
browserClick -- windows only makes this unhelpful

global browserCancel
put true into browserCancel - stops browser progress but no place to put it to stop initial browser window

If I could just script this initial window or prevent it from being created, that would help. Would inserting a javascript help, if there is no solution to the above?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: revBrowserCEF - Handle New Window/Tab Request

Post by jacque » Tue Mar 29, 2016 7:05 pm

The only message I get when a new window is not opened or the URL does not change is browserNavigateComplete, which is sent after the instance has finished navigating but before the contents are redrawn on screen. You only get browserBeforeNavigate when opening a new URL (or window, apparently.)

You might try not opening a new window, and trapping browserNavigateComplete. My tests were done using internal hashtag links, where I only got browserNavigateComplete because the URL was basically the same as the page currently displayed, except for the #<hashtag>.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Internet”