0

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");
2
  • with that, the only thing that comes out in my mind is that javascript is disabled in the browser... Commented Jun 11, 2010 at 9:51
  • could it be that your file is local and the security settings for local files is set to not allow scripts ? Commented Jun 11, 2010 at 9:52

1 Answer 1

3

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 from www.mydomain.com/content/pages/CodeMirror/js/codemirror.js, not www.mydomain.com/CodeMirror/js/codemirror.js.

One thing that you can improve is to add the type attribute to the tag:

<script src="CodeMirror/js/codemirror.js" type="text/javascript"></script>
Sign up to request clarification or add additional context in comments.

1 Comment

When I got home from work and tried it again, it magically worked (I didn't change a thing). I have no clue why it wasn't working before! Perhaps a browser cache or ASP.NET Development Server bug... but thanks :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.