I’ve been futzing with this for hours trying to figure out why codemirror.js won’t load in any browser other than Firefox. Any ideas?
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title></title>
<script src="CodeMirror/js/codemirror.js"></script>
<link href="Styles/Style.css" rel="stylesheet" type="text/css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function () { $('#container-1').tabs(); });
</script>
<style type="text/css"> /* (some css) */ </style>
</head><body>
<!-- (some stuff) -->
</body></html>
CodeMirror/js/codemirror.js
alert("LOL");
I tried the code in Firefox 3.6.3, Internet Explorer 8, Opera 10.53 and Safari 4.0.5, and it works just fine.
Note that the address to the script is relative, so if your page is at
www.mydomain.com/content/pages/page.html, it will load the script fromwww.mydomain.com/content/pages/CodeMirror/js/codemirror.js, notwww.mydomain.com/CodeMirror/js/codemirror.js.One thing that you can improve is to add the
typeattribute to the tag: