Launching a Website

A website can be launched from an event using the following line of code:

Z.device.launchUrl("http://www.zappar.com");

On some platforms the website will be displayed in a view that is part of the Zappar app. If you'd like the website to be launched in the user's default web browser (e.g. Safari on iOS) then you can use the following line of code:

Z.device.launchUrl("http://www.zappar.com", false); // false indicates to not use embedded view

Make sure that websites that you launch are mobile-optimized for the best user experience.

Non-web links such as mailto, sms, tel and deep links need the false argument passed to function correctly.

Twitter Web Intents

It's also possible to use this functionality to launch Twitter Web Intents. This means you can pre-populate a tweet for the user to send if they wish. The example below pre-populates a tweet to the @ZapparApp Twitter account stating "ZapWorks Studio is awesome".

Z.device.launchUrl("https://twitter.com/intent/tweet?text=ZapWorks%20Studio%20is%20awesome&via=zapparapp",false);

For more information on Twitter Web Intents, please see the Twitter Developer Documentation.

More Information

  • Z.Device - the object used for launching websites
  • Scripts - the Getting Started article introducing scripts
zapcode branded_zapcode i