Helpful Information
 
 
Category: General Articles
Alert and redirect mobile devices

You can make your forum produce an unobtrusive javascript alert whenever your community members view your site from a mobile device, such as an Apple iPhone/iPod, Android-based device or Symbian-based device by entering a little javascript in your forum's header or footer template.


function detectMobilePlatform() {
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
if (confirm("The message you want them to see.")) {
document.cookie = "mobile_redirect=false";
window.location = "http://link/to/page";
} else {
setNoRedirect();
}
} else if(navigator.userAgent.match(/android/i)) {
if (confirm("The message you want them to see.")) {
document.cookie = "mobile_redirect=false";
window.location = "http://link/to/page";
} else {
setNoRedirect();
}
} else if((navigator.userAgent.match(/Symbian/i)) || (navigator.userAgent.match(/Nokia/i))) {
if (confirm("The message you want them to see.")) {
document.cookie = "mobile_redirect=false";
window.location = "http://link/to/page";
}
}

function setNoRedirect() {
var date = new Date();
var days = 30;
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+ date.toGMTString();
document.cookie = "mobile_redirect=false" + expires;
}
detectMobilePlatform()


If you are placing this in the footer, place it just before the </body> closing tag. In the header, place it just before the <body> tag. For site speed and optimisation, I recommend you place the code in the footer.

Replace the message with whatever message you want your forum members to see, and replace the URL to the resource you want them to see when they click ok on the mobile device.

awesome
it will help in my site
becuse its for mobile stuf
and most users are visiting it from mobile
http://www.7elm3aber.com/vb










privacy (GDPR)