-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-intents.html
83 lines (75 loc) · 2.45 KB
/
web-intents.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Web Intents - Pick Media</title>
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="index.html">Device APIs demos</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="about.html">About/Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Important bit starts HERE -->
<div class="container">
<div class="row-fluid">
<div class="span12"><p class="lead">Invoking Web Intents...</p> </div>
</div>
<div class="row-fluid">
<div class="span12">
<p>Select Media files...</p>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<button id="picker">Pick files...</button>
</div>
</div>
<div class="row-fluid">
<div id="grid" class="span12">
....
</div>
</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script src="js/bootstrap-transition.js"></script>
<script src="js/bootstrap-collapse.js"></script>
<script src="http://webintents.org/webintents.min.js"></script>
<script type="text/javascript">
var picker = document.getElementById('picker');
picker.addEventListener("click", doIntentStuff, false);
var Intent = window.Intent || window.WebKitIntent;
var myIntent = new Intent("http://webintents.org/pick", "http://w3.org/type/media");
function mediaOK (mediaObjectArray) {
console.log("success selecting Media");
//display what was selected...
}
function mediaFail (err) {
// display an error to the user
console.log("Failed trying to Pick Media using Web Intents!");
}
function doIntentStuff(e) {
startActivity = (window.navigator.startActivity || window.navigator.webkitStartActivity);
startActivity(myIntent, mediaOK, mediaFail);
}
</script>
</body>
</html>