Last active
August 29, 2015 14:15
-
-
Save chiemseesurfer/ffeee442b8c770b07efc to your computer and use it in GitHub Desktop.
Switch between screen and mobile view with javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { | |
var cssUrl = "media/css/handheld.css"; | |
var head = document.getElementsByTagName("head")[0]; | |
var link = document.createElement("link"); | |
link.rel = "stylesheet"; | |
link.type = "text/css"; | |
link.href = cssUrl; | |
document.head.appendChild(link); | |
} else { | |
var cssUrl = "media/css/style.css"; | |
var head = document.getElementsByTagName("head")[0]; | |
var link = document.createElement("link"); | |
link.rel = "stylesheet"; | |
link.type = "text/css"; | |
link.href = cssUrl; | |
document.head.appendChild(link); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment