revBrowserOpen versus revBrowserOpenCef

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: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pthirkell
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 93
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

revBrowserOpen versus revBrowserOpenCef

Post by pthirkell » Sun Oct 26, 2014 10:21 am

I remain somewhat confused about which function to use to initiate a browser instance on desktop. The Dictionary says to use revBrowserOpenCef() to initialise a new Chrome-based browser, but when I try this it has some issues. If I use revBrowserOpen() under Livecode 7.0 it works, but is it (automatically) the new (Chrome-based) browser? If so then revBrowserOpenCef() is essentially redundant?

Thanks clarification

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

Re: revBrowserOpen versus revBrowserOpenCef

Post by Klaus » Sun Oct 26, 2014 11:55 am

HI pthirkell,

not redundant at all!

As you said, "revBrowserOpenCEF" will use the Chrome browser framework on Mac and Win!
A simple "revBrowserOpen" will use the Safari (Webkit) framework on Mac and the IE framework on Windows.
I thought this would be nonambiguous 8)

Anyway, what issues are you experiencing?


Best

Klaus

pthirkell
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 93
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

Re: revBrowserOpen versus revBrowserOpenCef

Post by pthirkell » Sun Oct 26, 2014 10:08 pm

Thanks Klaus for prompt reply.

I became confused after reading the very good Embedded Web article as part of the recent 7 Benefits of 7 piece in the October Livecode Newsletter. The article leads off by saying that "the new implementation of the CEF Browser Object means that developers can create hybrid apps that incorporate web content easily with consistent content on Mac and Windows," suggesting that we need to use revBrowserOpenCef() when instantiating a new browser object. The Embedded Web article includes a helpful video demo by Ben from Day 1 of this year's conference.

Yet when I look at the stack example provided by Ben for that demo, his code uses revBrowserOpen() - i.e...

put revBrowserOpen(the windowId of this stack, "file://"&stackPath()&"/index2.html") into sBrowserID

Secondly, a point of clarification. Can I use revBrowserAddJavaScriptHandler with revBrowserOpen() or does it require revBrowserOpenCef() ?

Thirdly, and more generally (and forgiving my lack of knowledge - maybe I should have posted in the beginners forum :?) ... what does the Chrome Browser allow that the Webkit/Explorer browser doesn't allow? In other words why should I need to use revBrowserOpenCef() ?

Fourthly, the particular problem I have is that revBrowserOpenCef() doesn't allow proper playback of movies. If I create a new main stack, make it a little bigger (say 1200 by 900), and add a button near the bottom of the card with the following script ...

on mouseUp
local tBrowserId,tResizeBrowser
put revBrowserOpen(the windowId of this stack, "http://www.apple.com/watch/films/") into tBrowserId
put "0,0," & the width of this stack & "," & the height of this stack -50 into tResizeBrowser
revBrowserSet tBrowserId, "rect", tResizeBrowser
end mouseUp

then it works when I play any of the movies listed ... (well except for the fullscreen option on the player controller which I have logged as a bug).

If however I use the same script but with revBrowserOpenCef() instead of revBrowserOpen(), then the movie player doesn't load fully. Maybe a bug?

Thanks any further advice/guidance.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revBrowserOpen versus revBrowserOpenCef

Post by [-hh] » Wed Oct 29, 2014 2:23 pm

This is my experience:

On Mac I don't use revBrowserOpenCEF until now, because it is not yet able to display local PDFs (while revBrowserOpen does).

On Windows it displays local and remote PDFs and (for me) also perfectly displays/streams youTube videos (flash).
Of course you need new (may be the newest) FlashPlayer and Reader plugins for that from Adobe.
shiftLock happens

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm
Location: Greece

Re: revBrowserOpen versus revBrowserOpenCef

Post by zaxos » Wed Oct 29, 2014 2:30 pm

1) revBrowserOpenCef supports HTML5 code while revBrowserOpen dosent
2) If you use revBrowserOpenCef in your code your Externals folder will jump up to 60mb while revBrowserOpen is about 1mb if i recall
Conclusion, if you are not going to load HTML5 then dont use revBrowserOpenCef, alteast not untill they make those externals a bit smaller
Knowledge is meant to be shared.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revBrowserOpen versus revBrowserOpenCef

Post by [-hh] » Wed Oct 29, 2014 2:57 pm

zaxos wrote: revBrowserOpenCef supports HTML5 code ...
This is very interesting, I must have missed this.
Could you please give a short example line how to display a local PDF on Mac with revBrowserOpenCEF (what is certainly, in some way, possible in HTML5)?
shiftLock happens

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm
Location: Greece

Re: revBrowserOpen versus revBrowserOpenCef

Post by zaxos » Wed Oct 29, 2014 3:27 pm

Hi there [-hh], hers a code i tested on windows and worked, i dont have MAC so its up to you to tell us if it works:
HTML:

Code: Select all

<head>
<title></title>
<body>
<embed src="test.pdf" width="600" height="500" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">
</body>
</head>
Livecode:

Code: Select all

on mouseUp
   repeat for each item theItem in revBrowserInstances()
      revBrowserClose theItem
   end repeat
   put revBrowserOpenCef(the windowID of this stack , "D:\test.html") into tBrowserID
   revBrowserSet tBrowserID, "rect", the rect of grc "Browser"
end mouseUp
Knowledge is meant to be shared.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revBrowserOpen versus revBrowserOpenCef

Post by [-hh] » Wed Oct 29, 2014 4:51 pm

Hi zaxos.

Good idea to embed this, but sadly it also doesn't work on Mac ("couldn't load plugin").
The same code, with revBrowserOpen only, works. I reported this as a bug (may be this is not the culprit of LC, but comes from the CEF on Mac).

p.s. On Windows I had also success with the "direct" call (of the PDF) by the CEF:

Code: Select all

put revBrowserOpenCEF(the windowID of this stack , \
    "file:" && "C:/Users/hh/Documents/test.pdf") into tBrowserID
shiftLock happens

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm
Location: Greece

Re: revBrowserOpen versus revBrowserOpenCef

Post by zaxos » Wed Oct 29, 2014 5:34 pm

MAC does not support adobe flash if i recall, maybe thats the problem..
Knowledge is meant to be shared.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revBrowserOpen versus revBrowserOpenCef

Post by [-hh] » Wed Oct 29, 2014 6:00 pm

Also on Mac revBrowserOpen works, with both local and remote PDF (Reader plugin) and also flv streaming (Flash Plugin).
And revBrowserOpenCEF works also on Mac with *remote* embedded PDF (Reader plugin). That is to have this with a local PDF one has to run a local webServer :-(
shiftLock happens

James Little
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 47
Joined: Thu Apr 27, 2006 11:19 pm
Location: Seattle

Re: revBrowserOpen versus revBrowserOpenCef

Post by James Little » Thu Sep 17, 2015 5:02 am

Hi All,

I know this is an old thread but I have a similar problem. I’m trying to display a local pdf in a browser on Mac (10.9.5). I’ve tried LC 7.1 rc2 and LC 8.0 dp4. I’ve also tried both revBrowserOpen and revBrowserOpenCEF.
See my script below and the file path. Any suggestions?

Thanks,

Jim L.

Code: Select all

on menupick pPick 
    local tActiveURL
    set the defaultFolder to (tDefaultFolder & "/" & "MGFactSheets")
    put "file:/" & the defaultFolder & "/" & pPick into tActiveURL
     put tActiveURL into msg
     put the windowid of this stack into tWinID
     put revBrowserOpen(tWinID,"") into sBrowserId
     revBrowserSet sBrowserId, "rect", rect of grc "BrowserRect"
     revBrowserSet sBrowserId, "url", tActiveURL
end menupick 
Here’s what my file path looks like.

file://Users/littlejamesw/Desktop/GardenAidLC8/GardenAidLC8Files/MGFactSheets/MG10.pdf

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revBrowserOpen versus revBrowserOpenCef

Post by [-hh] » Thu Sep 17, 2015 7:44 am

Please try (watch the second slash)

Code: Select all

put "file://" & ..
shiftLock happens

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”