SuperCard Programming/Tips & Tricks/Sending a URL to the default browser

SuperCard's send command is the prescribed way to send a URL to a browser:

on mouseUp send [URL] to program [name of browser] with "GURLGURL" without reply end mouseUp

Example: on mouseUp send "http://supercard.us" to program "Safari" with "GURLGURL" without reply end mouseUp

The problem with this method is that your program shouldn't assume that the user wants a URL opened with Safari, or any other specific browser for that matter.

Fortunately, you can load a URL in the user's default browser by using SuperCard's shell function:

get shell ("open http://supercard.us")

If you don't want to hard code the URL, you can grab it from a field:

on mouseUp put [cd/card/bg/background] field [name of field] into [name of variable] get shell("open " & [name of variable]) end mouseUp

Example:

on mouseUp put bg field FieldURL into theURL get shell("open " & theURL) end mouseUp