Opening a web page in a card
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 28
- Joined: Fri Jun 26, 2015 6:17 pm
Opening a web page in a card
How do I tell livecode to open a web page in a card. I don't want any controls on the card, just the web site showing and a return to home card button which I will make at the bottom.
What is the code for my button that will open the card and display the web page. Below is the page I want to open in my app. It's using the Bootstrap3 theme which is optimized for mobile.
http://spokaneesl.com/presenters/
Thanks,
Ron
What is the code for my button that will open the card and display the web page. Below is the page I want to open in my app. It's using the Bootstrap3 theme which is optimized for mobile.
http://spokaneesl.com/presenters/
Thanks,
Ron
-
- Posts: 28
- Joined: Fri Jun 26, 2015 6:17 pm
Re: Opening a web page in a card
Thanks. That made sense and I was able to do it. How do I resize the "browserPlaceholder" the graphic object? Once it's populated with the web page, it no longer has handles on it to be able to resize on the stack.
Re: Opening a web page in a card
Hi Ronnie,
yes, this is how these externals like the BROWSER object work!
They put an OVERLAY on top of all controls, which is not really part of the stack.
You will need to change the rect of the browser by script! We cannot resize a browser manually!
Resizing the "reference" graphic will still require that you set the browsers rect by script!
In fact the "reference" object is really not necessary, it just makes the whole thing more "visual".
You can of course supply a rect directly to the browser like this, which will cover the complete card but leave
a 30 pixel area at the bottom of the card:
...
put "0,0," & the width of this stack & "," & the height of this stack - 30 into tRect
revBrowserSet tBrowserID, "rect", tRect
...
Best
Klaus
yes, this is how these externals like the BROWSER object work!
They put an OVERLAY on top of all controls, which is not really part of the stack.
You will need to change the rect of the browser by script! We cannot resize a browser manually!
Resizing the "reference" graphic will still require that you set the browsers rect by script!
In fact the "reference" object is really not necessary, it just makes the whole thing more "visual".
You can of course supply a rect directly to the browser like this, which will cover the complete card but leave
a 30 pixel area at the bottom of the card:
...
put "0,0," & the width of this stack & "," & the height of this stack - 30 into tRect
revBrowserSet tBrowserID, "rect", tRect
...
Best
Klaus
-
- Posts: 28
- Joined: Fri Jun 26, 2015 6:17 pm
Re: Opening a web page in a card
Okay. I see. I've done this and put a button at the bottom of the browser instance card to return to the main card. However, the browser instance is being applied to the home page too overlaying it.
How do I end the browser instance when I go to another card?
Here's the code to return to my main card.
on mouseUp
go to card 1
end mouseUp
How do I end the browser instance when I go to another card?
Here's the code to return to my main card.
on mouseUp
go to card 1
end mouseUp
Re: Opening a web page in a card
Hi Ron,
I ususally put this into the card script:
So the browser will close automatically when leaving the card.
Best
Klaus
I ususally put this into the card script:
Code: Select all
on closecard
revbrowserclose sBrwoserID
end closecard
Best
Klaus
-
- Posts: 28
- Joined: Fri Jun 26, 2015 6:17 pm
Re: Opening a web page in a card
Hi Klaus,
Something is still not working with this. On my main stack page I have a button that opens another card with a browser instance.
on mouseUp
go to card "Presenter info card"
put revBrowserOpenCef(the windowId of this stack, "http://spokaneesl.com/presenters/index.html") into tBrowserID
revBrowserSet tBrowserID, "rect", the rect of field "browserPlaceholder"
end mouseUp
This above is all working. The card "Presenter info card" is populated with the web site that I want. At the bottom of the card, there is a button which says "Return to home card."
on mouseUp
go to card 1
end mouseUp
In the card script titled "Presenter info card", I have this code.
on closecard
revbrowserclose sBrowserID
end closecard
But when I click the button to leave the card and return to the home card, I get an unknown browser id message.
What am I doing wrong?
Something is still not working with this. On my main stack page I have a button that opens another card with a browser instance.
on mouseUp
go to card "Presenter info card"
put revBrowserOpenCef(the windowId of this stack, "http://spokaneesl.com/presenters/index.html") into tBrowserID
revBrowserSet tBrowserID, "rect", the rect of field "browserPlaceholder"
end mouseUp
This above is all working. The card "Presenter info card" is populated with the web site that I want. At the bottom of the card, there is a button which says "Return to home card."
on mouseUp
go to card 1
end mouseUp
In the card script titled "Presenter info card", I have this code.
on closecard
revbrowserclose sBrowserID
end closecard
But when I click the button to leave the card and return to the home card, I get an unknown browser id message.
What am I doing wrong?
Re: Opening a web page in a card
Hi Ronnie,
Best
Klaus
you are using MY example variable nameronniebellie wrote:What am I doing wrong?
Code: Select all
...
## My example: sBrowserID
## revbrowserclose sBrowserID
## Your actual variable name: tBrowserID
revbrowserclose tBrowserID
...
Klaus
-
- Posts: 28
- Joined: Fri Jun 26, 2015 6:17 pm
Re: Opening a web page in a card
This code I thought used to work in v. 7x to open a web page on a card, but in V.8 it doesn't
Do you know why?
global tBrowserID
on mouseUp
go to card "placeholder"
put revBrowserOpenCef(the windowId of this stack, "http://spokaneesl.com/exhibitors/index.html") into tBrowserID
put "0,0," & the width of this stack & "," & the height of this stack - 30 into tRect
revBrowserSet tBrowserID, "rect", tRect
end mouseUp
Do you know why?
global tBrowserID
on mouseUp
go to card "placeholder"
put revBrowserOpenCef(the windowId of this stack, "http://spokaneesl.com/exhibitors/index.html") into tBrowserID
put "0,0," & the width of this stack & "," & the height of this stack - 30 into tRect
revBrowserSet tBrowserID, "rect", tRect
end mouseUp
Re: Opening a web page in a card
Hi Ronnie,
is this on a Mac?
From the "Release Notes" of LC 8:
##################################################
Removal of CEF support from OS X version of revBrowser external and 8.0 browser widget. (8.0.0-dp-16)
Due to the lack of support for 32-bit Chromium on Mac OS X (and thus Chromium Embedded Framework)
we will no longer be using libCEF to provide an embedded browser on OSX, either with the revBrowser external, or the new browser widget.
If you currently use revBrowser and the revBrowserOpenCEF command to create the browser, this will no longer function.
We advise you to switch to using revBrowserOpen when your application is running on OSX.
The browser widget will continue to function as before, as the implementation has already been changed to use the OSX WebView class by default.
##########################################
Get used to the new browser widget, very nice!
Best
Klaus
is this on a Mac?
From the "Release Notes" of LC 8:
##################################################
Removal of CEF support from OS X version of revBrowser external and 8.0 browser widget. (8.0.0-dp-16)
Due to the lack of support for 32-bit Chromium on Mac OS X (and thus Chromium Embedded Framework)
we will no longer be using libCEF to provide an embedded browser on OSX, either with the revBrowser external, or the new browser widget.
If you currently use revBrowser and the revBrowserOpenCEF command to create the browser, this will no longer function.
We advise you to switch to using revBrowserOpen when your application is running on OSX.
The browser widget will continue to function as before, as the implementation has already been changed to use the OSX WebView class by default.
##########################################
Get used to the new browser widget, very nice!
Best
Klaus