Hello
Here is a way to handle deeplink if application is not installed in mobile.
Following is the index.html file for handling deeplink-
Where myapp:// is deep link url of my application
Then after deploy your project on heroku.com and send the project url by email , which is generated by heroku to handle deeplink.
Thanks...
Here is a way to handle deeplink if application is not installed in mobile.
Following is the index.html file for handling deeplink-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<script type="text/javascript" src="js/deepLinkHandler.js"></script>
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript">
window.onload = function () {
document.getElementById("url").click();
}
</script>
</head>
<body>
<div class="outer">
<div class="inner">
<a id="url" href="myapp://" onclick="clickHandler()"></a>
<img src="../images/default.gif"/>
<p>
Redirecting to my app...<br>
Please wait...
</p>
</div>
</div>
</body>
</html>
Where myapp:// is deep link url of my application
Following is the style.css file for handling deeplink-
and image for the index.html page-
img {
top: 35%;
right: 0;
left: 0;
margin: 0 auto;
vertical-align: middle;
}
.outer{
display: table;
width: 100%;
height: 100vh;
}
.inner{
text-align: center;
display: table-cell;
right: 0;
left: 0;
vertical-align: middle;
margin: 0 auto;
}
and image for the index.html page-
Following is the deepLinkHandler.js file for handling deeplink-
function clickHandler() {
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);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if( isMobile.Android() ) {
alert("Android");
setTimeout(function(){
window.location.href = "https://www.google.co.in/";
}, 5000);
}
else{
setTimeout(function(){
window.location.href = "https://www.google.co.in/";
}, 5000);
}
}
Then after deploy your project on heroku.com and send the project url by email , which is generated by heroku to handle deeplink.
Thanks...
No comments:
Post a Comment