Skip to content

Instantly share code, notes, and snippets.

@Albirew Albirew/ratio.js
Created Jan 12, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.