Skip to content

Instantly share code, notes, and snippets.

Created April 16, 2013 07:22
Show Gist options
  • Save anonymous/5394042 to your computer and use it in GitHub Desktop.
Save anonymous/5394042 to your computer and use it in GitHub Desktop.
Demonstration of the different ways to open a URL using PhoneGap.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<title>Hello World</title>
<script type="text/javascript" src="cordova-2.5.0.js"></script>
</head>
<body>
<a href="#" onclick="var ref = window.open('http://google.com', '_system');">Google (System Browser)</a><br /><br />
<a href="#" onclick="var ref = window.open('http://google.com', '_blank');">Google (InAppBrowser)</a><br /><br />
<a href="#" onclick="var ref = window.open('http://google.com', '_self');">Google (Webview)</a>
</body>
</html>
@deywibkiss
Copy link

ok that's right... but how about to open system files for example: file:///sdcard... the browser is not launched with these kind of URLs but http and https

@netalex
Copy link

netalex commented Jan 16, 2014

look for "file" plugin

@vivekkaushal1
Copy link

how to open a page on app load ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment