File: example.html

Recommend this page to a friend!
  Classes of Arturs Sosins   Mobile Detect   example.html   Download  
File: example.html
Role: Example script
Content type: text/plain
Description: Detect what type of device/browser is used
Class: Mobile Detect
Detect if the user browser is on a mobile device
Author: By
Last change:
Date: 11 years ago
Size: 2,541 bytes
 

Contents

Class file image Download
<!DOCTYPE html> <!-- /************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com * Feel free to distribute and modify code, but keep reference to its creator * * Glint effect provides you an ability to add glint effect * to different HTML objects, which can append canvas element * * For more information, examples and online documentation visit: * http://webcodingeasy.com/JS-classes/Javascript-glint-effect **************************************************************/ --> <html> <head> </head> <body style='padding: 50px;'> <ul> <li>If you visit this page from IOS device, link will go to appstore</li> <li>If you visit this page from Android device, link will go to Google Play</li> <li>If you visit this page from Kindle device, link will go to Amazon Market</li> <li>If you visit this page from Samsung device, link will go to Samsung Market</li> <li>By default link goes to developer's website</li> </ul> <h3>Mashballs</h3> <a id='applink' href='http://jenots.com/mashballs'><img src='Mashballs.png'/></a> <script type="text/javascript" src="./MobileDetect.packed.js" ></script> <script type="text/javascript"> var md = new MobileDetect(); //but if current viewing device is IOS //we can give direct Apple AppStore link for app var forIOS = function(){ document.getElementById("applink").href = 'https://itunes.apple.com/us/artist/jenots.com/id568842425'; }; //and if current viewing device is Android //we can give direct Googple Play link for app var forAndroid = function(){ document.getElementById("applink").href = 'https://play.google.com/store/apps/developer?id=Jenots'; }; //and if current viewing device is Kindle //we can give direct Amazon link for app var forKindle = function(){ document.getElementById("applink").href = 'http://www.amazon.com/Jenots-com-Mashballs/dp/B00A8XM250'; }; //and if current viewing device is Samsung //we can give direct Samsun market link for app var forSamsung = function(){ document.getElementById("applink").href = 'http://www.amazon.com/Jenots-com-Mashballs/dp/B00A8XM250'; }; //assign callbacks for scpecific devices md.addEventListener("iphone", forIOS); md.addEventListener("ipad", forIOS); md.addEventListener("ipod", forIOS); md.addEventListener("itunes", forIOS); md.addEventListener("android", forAndroid); md.addEventListener("samsung", forSamsung); md.addEventListener("kindle", forKindle); </script> </body> </html>