I need to switch to a mobile view of a website using plain HTML or javascript... er, anything that doesn't require serverside scripting. Our website is being semi-temporarily hosted via Dropbox. ( http://teammetalcow.com redirects to a HTML file in the public folder.) I need a way so that we can detect the user's type of device then display a mobile or desktop version, appropriately. Having a simple way to tack on a mobile site would be prefferred. Is this even possible? Tons of thanks if you can help.
You can try some library like breakpoint : https://github.com/martinmartinmartin/breakpoint/ or study this javascript : http://www.sitepoint.com/javascript-media-queries/
you just need to detect device with javascript, then redirect.
// in case of a viewport
if (document.documentElement.clientWidth < 900) {
// scripts --> redirect
window.location = "http://www.disney.com"
}
// in case of a screen
if (screen.width < 900) {
// scripts --> redirect
window.location = "http://www.disney.com"
}
Carry on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With