Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
(switch agent to lowercase to see if it makes a difference) |
(rewrite) |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | if( | + | if(navigator.userAgent.toLowerCase().indexOf("android") != -1) |
{ | { | ||
− | + | document.location(document.URL + "?useformat=mobile"); | |
− | + | } | |
− | + | else if(document.documentElement.clientWidth <= 787 && document.URL.search("mobile") == -1) | |
− | + | { | |
− | + | window.location.replace(document.URL + "?useformat=mobile"); | |
− | |||
− | |||
− | |||
} | } |
Revision as of 13:32, 6 April 2013
/* Any JavaScript here will be loaded for all users on every page load. */ if(navigator.userAgent.toLowerCase().indexOf("android") != -1) { document.location(document.URL + "?useformat=mobile"); } else if(document.documentElement.clientWidth <= 787 && document.URL.search("mobile") == -1) { window.location.replace(document.URL + "?useformat=mobile"); }