VIII · 50
openURL() in Programming
Many programming environments have a function called openURL or openUrl. None of them is related to the OpenURL citation standard. Here is what they do.
If you arrived here after searching for openURL(...) in some code, you are probably looking at a function that simply opens a web address in a browser or another app. The name is a coincidence. The OpenURL standard documented on the rest of this site is ANSI/NISO Z39.88, a way of encoding library citations in URLs.
Common openURL functions
- iOS:
UIApplication.openURL(_:) - Asked iOS to open a URL in Safari or in the app registered for its scheme (
tel:,mailto:, custom schemes). Deprecated in iOS 10 in favour ofUIApplication.shared.open(_:options:completionHandler:). In SwiftUI, use theopenURLenvironment value or aLinkview. - macOS:
NSWorkspace NSWorkspace.shared.open(_:)(Objective-CopenURL:) opens a URL with the default application.- Qt:
QDesktopServices::openUrl() - Opens a URL in the user's default browser or handler application and returns whether that succeeded.
- Flutter:
url_launcher - The
url_launcherpackage'slaunchUrl()opens links. Its olderlaunch()function is deprecated. - JavaScript on web pages
- Browsers have no built-in
openURL(); the standard call iswindow.open(url). Calls such asopenURL('/content/file.pdf')in old web pages are custom functions defined by that site, usually wrappers aroundwindow.openorlocation.href. - Desktop scripting and other environments
- Various scripting languages, plug-in APIs and automation tools have their own "open URL" commands. They all open an address; check that product's documentation for details.
How to tell which "OpenURL" you are dealing with
- If you see a function call with parentheses,
openURL(…), it is a programming function that opens a link. - If you see query parameters such as
ctx_ver=Z39.88-2004,rft_val_fmt=,rft.atitle=,sid=orgenre=article, it is the OpenURL citation standard. Start with What is OpenURL? or paste it into the parser.