Page 1 of 1
Open Browser Link in Safari instead of Browser
Posted: Mon Dec 12, 2011 10:56 pm
by Tester2
I have an html List View page on my server with a list of links and I am displaying it in my app via the in-app Browser.
Whenever someone clicks on the links on my html page, I would like the user to be taken to that link in Safari not in my in-app Browser.
How do I do this??
Please help!
Thanks bunches.
-Tester2
Re: Open Browser Link in Safari instead of Browser
Posted: Mon Dec 12, 2011 11:22 pm
by Jellicle
(From the release notes)
URL launching support
Support for launching URLs has been added. The launch url command can now be used to request the opening of a given url:
launch url urlToOpen
When such a command is executed, the engine first checks to see if an application is available to handle the URL. If no such application exists, the command returns "no association" in the result. If an application is available, the engine requests that it launches with the given url.
Using this syntax it is possible to do things such as:
• open Safari with a given http: url
• open the dialer with a given phone number using a tel: url
Important: Successfully launching a url will cause another application to open and the requesting application to be quit. The application will receive a shutdown message before this happens, however.
Re: Open Browser Link in Safari instead of Browser
Posted: Tue Dec 13, 2011 12:36 am
by Tester2
This is probably a dumb question, but bare with me as I'm a beginner.
I have the following code on a button:
on mouseUp
go to card "1"
put "
http://000.00.000.000/Folder/list_view_links.html" into field "Web"
end mouseUp
Then on the card 1, I am creating a Browser and setting the URL to the "Web" field.
How would I incorporate the launch url urlToOpen? The links that I want to open in Safari are listed in my html page's code not in the app...
Re: Open Browser Link in Safari instead of Browser
Posted: Tue Dec 13, 2011 10:26 am
by Jellicle
I think you can use a browserLoadRequest handler to catch requests to load URLs, and to handle them in alternative ways.
So something like (in a card script):
on browserLoadRequest pUrl
launch url pUrl
end on browserLoadRequest
pUrl is a parameter sent by the browser control - it'll contain the url selected by the user.
I can't try that out at the moment, so if it doesn't work...sorry
Gerry
Re: Open Browser Link in Safari instead of Browser
Posted: Wed Dec 14, 2011 7:51 pm
by Tester2
Hey Gerry,
Thanks so much for the reply.
I tried what you said and messed around with it and figured it out.
Since my delayRequests was not set to true I had to use
on browserLoadRequested pUrl, pType
launch URL pURL
end browserLoadRequested
instead of "browserLoadRequest"
But then it worked lovely.
Thanks again...
Re: Open Browser Link in Safari instead of Browser
Posted: Wed Dec 14, 2011 10:31 pm
by Jellicle
Tester2 wrote:But then it worked lovely.

Excellent
g