Added redirect for android users if they accept to the native app

This commit is contained in:
KasperRT
2015-02-27 15:50:11 +01:00
parent 50d6c4f7b6
commit 6055e30082

View File

@@ -90,5 +90,37 @@ foreach($fil as $files){
window.location.href = 'https://www.youtube.com/v/mK2fNG26xFg?autoplay=1&showinfo=0&autohide=1'; window.location.href = 'https://www.youtube.com/v/mK2fNG26xFg?autoplay=1&showinfo=0&autohide=1';
}); });
</script> </script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
}
$(document).ready(function (){
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){
console.log("android");
var ca = document.cookie.split(';');
if(getCookie("show_prompt") == "")
{
var r = confirm("Do you want to download the native app for this webpage?");
if(r)
window.location.href = 'https://play.google.com/store/apps/details?id=no.lqasse.zoff';
else
{
var d = new Date();
d.setTime(d.getTime() + (10*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = "show_prompt=false;"+expires;
}
}
}
});
</script>
</body> </body>
</html> </html>