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