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

Fix MathJax not rendering in Chrome when sessionStorage is disabled. #560

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion unpacked/MathJax.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,20 @@ MathJax.fileversion = "2.2";
// to be processed.
//
create: function (callback,node) {
// Accessing sessionStorage throws a SecurityError in Chrome is storage
// is disabled, thus breaking MathJax if the exception isn't caught.
sessionStorageCheck = function () {
try {
return typeof(window.sessionStorage);
} catch (exc) {
return "undefined";
}
}
callback = BASE.Callback(callback);
if (node.nodeName === "STYLE" && node.styleSheet &&
typeof(node.styleSheet.cssText) !== 'undefined') {
callback(this.STATUS.OK); // MSIE processes style immediately, but doesn't set its styleSheet!
} else if (window.chrome && typeof(window.sessionStorage) !== "undefined" &&
} else if (window.chrome && sessionStorageCheck() !== "undefined" &&
node.nodeName === "STYLE") {
callback(this.STATUS.OK); // Same for Chrome 5 (beta), Grrr.
} else if (isSafari2) {
Expand Down