简体   繁体   中英

JavaScript 304 Not Modified issue

I am having issues with a simple project I am doing. I am trying to play around with some JavaScript, HTML5, SVG drawing using Raphael.js. When I try loading the HTML page with the embedded JavaScript files I get a blank page in my browser. I checked Firebug and Chrome developer tools and I keep getting a 304 Not Modified error for my scripts and my HTML page.

I'm running this project on my local server using MAMP on a Mac OSX.

Here is my HTML:

<html>
    <head>
        <title>g.Raphael Practise</title>
        <script type="text/javascript" src="raphael-min.js"></script>
        <script type="text/javascript" src="g.pie-min.js"/></script>
        <script type="text/javascript" src="myscript.js"></script>
        <style type="text/css">
            #canvas-container {
                width: 500;
                border: 1px solid #aaa;
            }
        </style>

    </head>
    <body>
        <div id="canvas-container"></div>
    </body>


</html>

This is the content of "myscript.js":

    window.onload = function() {
    var paper = new Raphael(document.getElementById("canvas-container"), 500, 500);

    paper.piechart(250, 250, 100, [55, 20, 13, 32, 5, 1, 2]);

}

From the docs of g.raphaeljs :

include raphael.js , g.raphael.js and any (or all) of g.line.js , g.bar.js , g.dot.js and g.pie.js into your HTML page

Your current code doesn't really show an empty page, but you have to include the gRaphaël basic script as well to make it work:

    <script type="text/javascript" src="raphael-min.js"></script>
    <script type="text/javascript" src="g.raphael-min.js"/></script>
    <script type="text/javascript" src="g.pie-min.js"/></script>
    <script type="text/javascript" src="myscript.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM