//@Author - Harshit Pandey
//@Source -http://www.oyecode.com
<!-- ============================================================ -->
<!-- ======== Script for Mobile and Custom Design Tweaks ====== -->
<!-- ============================================================ -->
//Check if the browser agent in Mobile
function isMobile() {
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
}
else
{
return false;
}
}
//** Majority of Hand Held device handles multi-piclist selection
// with own custom way of handling them
// For web-version we need a special script called Bootstrap-Select
// Go here - http://silviomoreto.github.io/bootstrap-select/
// We are adding this script to give similar experience to end user
//Load Javascript based on Device of End-User
function loadConditionalScript()
{
//Set Location of Script
var jHead = document.getElementsByTagName('head')[0];
//Create Script Tag
var jScript = document.createElement('script');
//Add Source of Script
var source = https://cs12.salesforce.com/resource/1372471384000/GoogleMapHP/GoogleMap/js/map.js;
//Set Attributes
jScript.setAttribute("type", "text/javascript");
jScript.setAttribute("src", source);
//Check if Mobile
if(!isMobile())
{
//if Mobile
//Insert Script Dynamically
jHead.appendChild(jScript);
}
}
Post a Comment