Skip to content

Instantly share code, notes, and snippets.

@Albirew
Created January 12, 2016 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Albirew/bd613af596447b1b64c1 to your computer and use it in GitHub Desktop.
Save Albirew/bd613af596447b1b64c1 to your computer and use it in GitHub Desktop.
Un vieux JS pour rediriger l'utilisateur selon sa résolution (surtout pour différencier les smartphones)
/*JavaScript Redirection based on Ratio*/
var s = (screen.height/screen.width)
if (s==.75)
window.location.replace("/lol?somevars=4-3") // 4:3
else if (s==.625)
window.location.replace("/lol?somevars=8-5") // 8:5 (16:10)
else if (s==.5625)
window.location.replace("/lol?somevars=16-9") // 16:9
else if (s==.5294117647058824)
window.location.replace("/lol?somevars=17-9") // 17:9
else if (s==.6)
window.location.replace("/lol?somevars=5-3") // 5:3
else if (s==.8)
window.location.replace("/lol?somevars=5-4") // 5:4
else if (s>1)
window.location.replace("/lol?somevars=smartphones") // resolutions smartphones/tablettes
else
window.location.replace("http://albirew.fr/lol?somevars=others") // 3:2 et autres resolutions a la con
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment