Posted on May 19, 2011 by Vincent Nalupta
Total Posts: 1 | Join date: 05-19-11
Tags: There are no tags for this entry.
Posted on on May 19, 2011 at 2:34pm
by Michael Rosario
if((navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i)){
<< YOUR CODE HERE >>
};
$.cookie('mobile','on',{expires:7, path:'/', domain:'YOURDOMAIN.com'});
$.cookie('mobile','null',{expires:7, path:'/', domain:'YOURDOMAIN.com'});
if((navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i)) &&
( $.cookie("mobile") == null || $.cookie("mobile") == "on")
//Detect Browser and see if cookie is set
){
$.cookie('mobile','on',{ expires: 7, path: '/', domain:'YOURDOMAIN.com'}); // Set the cookie
$('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href','LOCATION OF MOBILE CSS') );
$('head').append('<meta name="apple-mobile-web-app-capable" content="yes" />');
// This code removes the browser bar
window.scrollTo(0,0);
setTimeout(function() { window.scrollTo(0, 1); }, 100);
} else {
if($.browser.msie)
{ // Do nothing on IE
} else {
$('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href','LOCATION OF SITE CSS') );
}};
<!--[if IE]>
<link rel="stylesheet" href="LOCATION OF SITE CSS" type="text/css" media="screen,print" />
<![endif]-->
/* Instead of $('head').append().attr(); approach */
$('body').addClass('mobile');
/* Instead of $('head').append().attr(); approach */
$('body').replace("URL");
Posted on on August 9, 2011 at 4:24am
by Ed Dawid
Posted on on December 1, 2011 at 4:00pm
by skypropyprott