Skip to content

Instantly share code, notes, and snippets.

@rahulinaction
Last active September 8, 2015 19:08
Show Gist options
  • Save rahulinaction/f5d347ea9c74a941273e to your computer and use it in GitHub Desktop.
Save rahulinaction/f5d347ea9c74a941273e to your computer and use it in GitHub Desktop.
Opening link in system browser
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<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>Cordova test file</title>
</head>
<body>
<div class="app">
<a href="http://www.yahoo.com" >My url</a>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/zepto.js"></script> /*Same as jquery but a bit lighter*/
<script type="text/javascript">
$(document).ready(function(){
document.addEventListener("deviceready",onDeviceReady, false);
function onDeviceReady() {
$('a').on("click",function(event){
event.preventDefault();
var anchor = $(this);
var value = anchor.attr("href");
window.open( value, '_system');
});
}
});
</script>
</body>
</html>
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.bombayworks.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Test Project</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
</widget>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment