Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added compatibility for Firefox & Internet Explorer #8

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions responsive-retrofit.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
(function() {

var fileUrl = "http://sparkbox.github.com/Responsive-Retrofitting/" + document.location.hostname + "/css/retrofit.css";

var cssLink = document.createElement('link');
cssLink.setAttribute('rel', 'stylesheet');
cssLink.setAttribute('type', 'text/stylesheet');
cssLink.setAttribute('href', "http://sparkbox.github.com/Responsive-Retrofitting/" + document.location.hostname + "/css/retrofit.css");
document.head.appendChild(cssLink);
cssLink.setAttribute('type', 'text/css'); // Changed the type from "text/stylesheet" to "text/css". This makes it work for Firefox.
cssLink.setAttribute('href', fileUrl);

if (document.createStyleSheet) {
document.createStyleSheet(fileUrl); // With IE, you must use createStyleSheet
} else {
document.head.appendChild(cssLink);
}

// Add meta tag, too!
var metaCode = document.createElement('meta');
Expand Down