-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
121 lines (113 loc) · 3.37 KB
/
index.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
<head>
<script language="javascript">
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
function launchiOSApp(url) {
var appleAppStoreLink = 'https://itunes.apple.com/us/app/randstad-jobs/id1060698980?mt=8';
var now = new Date().valueOf();
setTimeout(function () {
if (new Date().valueOf() - now > 500) return;
window.location = appleAppStoreLink;
}, 100);
window.location = url;
}
function launchIframeApproach(url, alt) {
var iframe = document.createElement("iframe");
iframe.style.border = "none";
iframe.style.width = "1px";
iframe.style.height = "1px";
iframe.onload = function() {
document.location = alt;
}
document.body.appendChild(iframe);
}
function launchWebkitApproach(url, alt) {
document.location = url;
timer = setTimeout(function () {
document.location = alt;
}, 2500);
}
function launchAndroidApp(url) {
var androidAppStore = "http://market.android.com/details?id=com.RandstadRecruiter";
var g_intent = "scheme=randstadjobs;package=com.RandstadRecruiter;end"; //see notes below
if(navigator.userAgent.match(/Chrome/)) {
var intent = url.replace('randstadjobs', 'intent') + '#Intent;' + g_intent; //see notes below
document.location = intent;
}
else if (navigator.userAgent.match(/Firefox/)) {
launchWebkitApproach(url, androidAppStore);
setTimeout(function () {
launchIframeApproach(url, androidAppStore);
}, 1500);
}
else {
launchIframeApproach(url, androidAppStore);
}
}
function getParameterByName(name, url) {
if (!url) url = location.href;
alert('location.href = '+location.href);
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
alert('result = '+results[1]);
return results == null ? null : results[1];
/*
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
*/
}
// Start //
var osURL='';
if(getParameterByName('sharing') === 'jobs')
{
var id = getParameterByName('jobId');
var lobId = getParameterByName('lobId');
osURL = 'randstadjobs://jobs/'+id +'/lobId/'+lobId;
alert('osURL = '+ osURL);
}
else
{
alert('here2');
osURL = 'randstadjobs://home';
}
if( isMobile.iOS()) {
launchiOSApp(osURL);
}
else if(isMobile.Android()){
launchAndroidApp(osURL);
}
else
{
// window.location.href = randstadusa
}
</script>
</head>
<body>
</body>
</html>