/
inappbrowser.html
44 lines (36 loc) · 1.42 KB
/
inappbrowser.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html>
<head>
<title>PGB Kitchen Sink</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div data-role="page" id="pageInAppBrowser" data-cache="never">
<script type="text/javascript" charset="utf-8">
// http://docs.phonegap.com/en/2.3.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser
$("#pageInAppBrowser").bind('pageshow', function() {
$("#btnOpenBrowser").off("click").on("click", function() {
var src = $("#txtUrl").val();
openBrowser(src);
gaPlugin.trackEvent( nativePluginResultHandler, nativePluginErrorHandler, "InAppBrowser", "Open Browser", src, 1);
});
});
function openBrowser(src) {
var ref = window.open(src, '_blank', 'location=yes');
ref.addEventListener('loadstart', function() { alert('start: ' + event.url); });
ref.addEventListener('loadstop', function() { alert('stop: ' + event.url); });
ref.addEventListener('exit', function() { alert(event.type); });
}
</script>
<div data-role="header">
<h1>In App Browser</h1>
</div><!-- /header -->
<div data-role="content">
<input type="text" id="txtUrl" value="http://apache.org" />
<br />
<button data-role="button" id="btnOpenBrowser">Open Browser</button>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>