Open Internet Browser/safari

Hello all,

I’m wondering how i’d creat an app that opened a specific link…

so basically the code would consist of an icon and a link… so when you open it, it just opens the link in a web browser.

I’ve tried numerous different code, but just keep getting a black screen app with nothing opening.

any help is appreciated!

Thanks,

Steven Glansberg

Hi there,

Have you tried the system.openURL() API?  http://docs.coronalabs.com/api/library/system/openURL.html  It sounds like it would do what you’re looking for.

  • Andrew

Hi there,

Have you tried the system.openURL() API?  http://docs.coronalabs.com/api/library/system/openURL.html  It sounds like it would do what you’re looking for.

  • Andrew

I have question that relates to this:
How do you open a 3rd party application, like pages, from your App?

Hi Matthew,

Did you try a URL scheme to open Pages, or direct the user to buy it if they don’t already have it? The following example is for Skype:

[lua]

local function onObjectTouch( self, event )

    if event.phase == “began” then

        print(“opening…”)

        local isAppInstalled = system.openURL(“skype://”)

        if isAppInstalled == false then

        --open appstore for skype if it is not installed

        system.openURL(“http://itunes.apple.com/br/app/skype/id304878510?mt=8”)

        end

    end

    return true  --important!

end

– begin detecting touches

button.touch = onObjectTouch

button:addEventListener( “touch”, button )

[/lua]

The catch is, you need to put in the target (other) app’s URL scheme, and sometimes it’s tricky to determine what this value is. You could try just “pages://” or maybe “app://pages”, and see if either one works…

Best regards,

Brent

No, i was wrong. just working on something now…

EDIT 2: Ok, so we tried all itterations of pages (pages:// , app://pages , Pages:// , app://Pages) and that doesn’t seem to work.

I’m going to try ibooks or something else regularly used to see if that makes a difference - any suggestions you have would still be greatly appreciated though :slight_smile:

I have question that relates to this:
How do you open a 3rd party application, like pages, from your App?

Hi Matthew,

Did you try a URL scheme to open Pages, or direct the user to buy it if they don’t already have it? The following example is for Skype:

[lua]

local function onObjectTouch( self, event )

    if event.phase == “began” then

        print(“opening…”)

        local isAppInstalled = system.openURL(“skype://”)

        if isAppInstalled == false then

        --open appstore for skype if it is not installed

        system.openURL(“http://itunes.apple.com/br/app/skype/id304878510?mt=8”)

        end

    end

    return true  --important!

end

– begin detecting touches

button.touch = onObjectTouch

button:addEventListener( “touch”, button )

[/lua]

The catch is, you need to put in the target (other) app’s URL scheme, and sometimes it’s tricky to determine what this value is. You could try just “pages://” or maybe “app://pages”, and see if either one works…

Best regards,

Brent

No, i was wrong. just working on something now…

EDIT 2: Ok, so we tried all itterations of pages (pages:// , app://pages , Pages:// , app://Pages) and that doesn’t seem to work.

I’m going to try ibooks or something else regularly used to see if that makes a difference - any suggestions you have would still be greatly appreciated though :slight_smile: