Apr 292011

Learn how to add a link to your iPhone application easily.

I know that it isn’t the most exciting thing you can do with the Corona SDK and Lua but adding working links can be very useful in encouraging users to learn more about your other apps.

So, follow the steps below!

Step 1:

Make a button for the function; for the sake of simplicity I’m calling it mybutton in the below code.

Step 2:

Insert the following snippet into your project, below where you created your button;

function openmylink (event)
system.openURL( "http://techority.com" )
mybutton:addEventListener("tap", openmylink)

Step 3: Profit!

It’s seriously that simple – go build it and test it out :)

I hope that while not hugely exciting you’ll enjoy this and find it useful – it’s another one of those search terms that people find Techority while Googling, yet I didn’t previously have a clear snippet of code for it.

Peach Pellen :)

Like this post? Subscribe to the monthly newsletter!


  4 Responses to “Adding A Link To Your iPhone App”

  1. wow..! It workz…
    Thanks Peach.

    Krishna Raj Salim

  2. It does, yes.

    On your computer, no – it’s like Twitter. If you use Twitter in your app (the way we do it currently) you’ll find clicking it in the simulator will open Twitter in your browser.

    Building for Xcode should work as well if you wish to test :)


  3. so…does this work inside the app? (meaning, if I have a button that calls out to send an email, does it open up the email functionality on the phone?).

    The app works in corona, but it opened up an email from my laptop mail client…just wanting to make sure… :-D

    Great little snippett!!!!

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.