Skip to content

Instantly share code, notes, and snippets.

@chiemseesurfer chiemseesurfer/header.html
Last active Aug 29, 2015

Embed
What would you like to do?
Switch between screen and mobile view with javascript
<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
You can’t perform that action at this time.