Can't display webpage from livecode Mac application

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jojo60
Posts: 2
Joined: Mon Oct 17, 2022 10:02 pm

Can't display webpage from livecode Mac application

Post by Jojo60 » Mon Oct 17, 2022 10:11 pm

Hi, who can help me getting to work a code like this on a Mac. In Windows it works fine. But not on my MacBook. Thanks. Kind regards Johan

on browserOpen
 put "http://www......." into sLink
 put revBrowserOpen(the windowId of this stack, sLink) into sBrowserID
 revBrowserSet sBrowserID, "rect" , the rect of graphic "browsersq"
 revBrowserSet sBrowserID, "scrollbars", false
end browserOpen

on mouseUp pMouseButton
 browserOpen
end mouseUp

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Can't display webpage from livecode Mac application

Post by stam » Mon Oct 17, 2022 11:58 pm

I just tried the example in the documentation:

Code: Select all

local tBrowserId
put revBrowserOpen(the windowId \
      of this stack, "http://www.livecode.com" ) into tBrowserId
if tBrowserId is not an integer then
  answer "Failed to open browser"
end if
This fails to open a safari window browser on Mac... i have no prior experience with this command, if this s not expected behaviour then a bug report is probably in order?

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Can't display webpage from livecode Mac application

Post by SparkOut » Tue Oct 18, 2022 7:34 am

Without knowing anything and not able to check the problem or the code, first guess is that the url needs to be https:// unless you can instruct the browser instance to disable secure site requirements.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Can't display webpage from livecode Mac application

Post by stam » Tue Oct 18, 2022 7:52 am

SparkOut wrote:
Tue Oct 18, 2022 7:34 am
Without knowing anything and not able to check the problem or the code, first guess is that the url needs to be https:// unless you can instruct the browser instance to disable secure site requirements.
I can’t check right now but seems unlikely. As far as I can tell from the documentation, this is meant open a new window in Safari and then navigate to the URL, however safari is never even launched - so it doesn’t appear to be a URL problem.
But I will check when I get a chance…

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Can't display webpage from livecode Mac application

Post by bn » Tue Oct 18, 2022 9:02 am

Hi Jojo,

I tried your code on a Mac

Code: Select all

local sBrowserID

on browserOpen 
   put "https://www.google.com" into sLink 
   put revBrowserOpen(the windowId of this stack, sLink) into sBrowserID 
   revBrowserSet sBrowserID, "rect" , the rect of graphic "browsersq" 
   revBrowserSet sBrowserID, "scrollbars", false
end browserOpen

on mouseUp pMouseButton 
   browserOpen
end mouseUp
I tried this after having tried a couple of times to create successfully a browser with slight variations of your code and then your code failed, debugging failed also.
Closing Livecode and reopening it then your code (as above) worked.

What I gather from this is that LC does not like too many browser instances at the same time.

Could you try this in a freshly started LC?
Why don't you use a Browser Widget?

Disclaimer:
I have hardly any experience using a browser in LC.

Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Can't display webpage from livecode Mac application

Post by bn » Tue Oct 18, 2022 9:03 am

@Stam

You have to set the rect of the browser to make it visible.

Kind regards
Bernd

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

Re: Can't display webpage from livecode Mac application

Post by Klaus » Tue Oct 18, 2022 9:25 am

What are the advantages of using revbrowseropen vs the browser widget?

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Can't display webpage from livecode Mac application

Post by stam » Tue Oct 18, 2022 10:58 am

bn wrote:
Tue Oct 18, 2022 9:03 am
You have to set the rect of the browser to make it visible.

Kind regards
Bernd
Thanks Bernd (as always!)... I was a bit mystified until i noticed the sentence quite far down, near the end of the documentation:
Dictionary/revBrowserOpen wrote:The default rect of a new browser instance is 0,0,0,0. To change this, set the "rect" property using the revBrowserSet command.
That's a blinder.... Perhaps this needs to be given a position of prominence in the documentation ;)

Also it really didn't do what i'd thought it would do based on how the Dictionary is written (namely launch Safari) but as Klaus points out just creates a browser inside the stack much like the browser widget but without the benefit of being able to manipulate the browser object in the IDE (plus it seems to cause a really annoying flicker on scrolling).

I have to echo Klaus' question:
Klaus wrote:
Tue Oct 18, 2022 9:25 am
What are the advantages of using revbrowseropen vs the browser widget?

Jojo60
Posts: 2
Joined: Mon Oct 17, 2022 10:02 pm

Re: Can't display webpage from livecode Mac application

Post by Jojo60 » Tue Oct 18, 2022 12:00 pm

Thank you all already for your help. Sites with https open fine, I see now too. It is about this "key2publish.../portal2/registration" site.
Unfortunately it will use http for a while. So I will try to find out how I can open it and check out your comments. Kind regards Johan

Post Reply

Return to “Mac OS”