FANDOM


Launches a url in the appropriate manner for the current system. Also for opening documents with the appropriate program. Syntax:

launch url urlToLaunch

Examples:

launch url "http://www.livecode.com"
launch url "file:/Users/ben/Desktop/test.pdf"
launch url "tel:44 7818 8822"

Use the launch url command to open a url using the default action for the current system. The command performs an action appropriate to the protocol and address provided in the given URL. Typical prefix are:

  • http: url - will launch in the default browser application if available.
  • file: path - open the file in the associated application (must be absolute path)
  • tel: url - open the dialer with a given phone number


When launch url is called, LiveCode 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.

The urlToLaunch must be a standards-compliant URL, in particular file urls must be of the form file://<absolute path>.

On mobile 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.

See Also: launch document Command, revGoURL Command, launch Command

TipsEdit

When some special characters create problems, for example the ~ char could be bad intepreted, you may use the shell function and quote the URL. For example on Mac:

put quote & "https://www.example.com/~myDomain/myPage.html" & quote into myURL
put shell("/Applications/Firefox.app/Contents/MacOS/firefox " & myUrl & " &")