在所有的瀏覽器:資源解釋爲腳本,但MIME類型文本轉/平淡的道:「文件:/// E:/ Projetions%20Matcher /Canvas/jquery.min.js」。
所以jquery.min.js被加載,但livello.js不是。爲什麼?
編輯:我試圖加載它的服務器上,但有相同的錯誤
HTML: ....
<script src="jquery.min.js" type="text/javascript"></script>
<script src="livello.js" type="text/javascript"></script>
....
livello.js:
var c=document.getElementById("app");
var ctx=c.getContext("2d");
function resize(){
c.style.width = window.innerWidth + 'px';
c.style.height = window.innerHeight + 'px';
var gameWidth = window.innerWidth;
var gameHeight = window.innerHeight;
var scaleToFitX = gameWidth/c.width;
var scaleToFitY = gameHeight/c.height;
var currentScreenRatio = gameWidth/gameHeight;
var optimalRatio = Math.min(scaleToFitX, scaleToFitY);
c.style.width = c.width * optimalRatio + "px";
c.style.height = c.height * optimalRatio + "px";
}
window.onresize=function(){resize();};
function clean()
{c.width=window.innerWidth;
c.height=window.innerHeight;}
clean();
的可能重複[鉻說,「資源解釋爲腳本,但使用MIME類型text/plain的轉移。」,怎麼辦?(http://stackoverflow.com/questions/3467404/chrome-says-resource-interpreted- as-script-but-transferred-with-mime-type-text)或者甚至更好http://stackoverflow.com/questions/12003107/resource-interpreted-as-script-but-transferred-with-mime-type-text -plain-for-l或http://stackoverflow.com/search?q=Resource+interpreted+as+Script+but+transferred+with+MIME+type+text%2Fplain – JJJ
另外,你應該真的安裝一臺服務器直接從文件系統打開文件。 – JJJ
@Juhana:1)不是因爲我在file:///而不在服務器上 2)但是爲什麼jquery在本地工作? –