JavaScript不能从networking驱动器工作

我试图运行下面的文件。 它在本地驱动器上运行时运行得非常好,但如果将其放在networking驱动器上,则不再有效。 任何想法,为什么这可能是?

下面是我试图运行的代码。 它从这里使用pivottable: https : //github.com/nicolaskruchten/pivottable 。

<!DOCTYPE html> <html> <head> <title> Demo</title> <!-- external libs from cdnjs --> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <!-- PivotTable.js libs from ../dist --> <link rel="stylesheet" type="text/css" href="../dist/pivot.css"> <script type="text/javascript" src="../dist/pivot.js"></script> <style> body {font-family: Verdana;} </style> <!-- optional: mobile support with jqueryui-touch-punch --> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> </head> <body> <script type="text/javascript"> // This example shows custom aggregators using $(function(){ var tpl = $.pivotUtilities.aggregatorTemplates; $.getJSON("col.json", function(frontier) { $("#output").pivotUI(frontier, { rows: ["Manager"], cols: ["Sector"], aggregators: { "Number of Positions": function() { return tpl.count()() }, "Manager Weight": function() { return tpl.sum()(["Port"])}, "Benchmark XGCC Weight": function() { return tpl.sum()(["Bench"])}, } }); }); }); </script> <div id="output" style="margin: 30px;"></div> </body> </html> 

File:///url将运行在与HTTP / HTTPS和其他上下文(内部,公共,私有,不安全)不同的上下文中。 有什么限制的问题取决于具体的浏览器,操作系统和上下文本身。

如果你必须在HTML中执行JavaScript,最安全和最可靠的方式就是通过Web服务器运行它。


另外值得注意的是,有一些本地/相关文件。 ../dist/pivot.js../dist/pivot.css你确定你正在保存这些文件,而且它们也处于正确的相对path?