通常狀況下,在chrome中運行一些含Ajax請求的界面原型時,會拋出下面錯誤:
XMLHttpRequest cannot load file:///D:/eclipse/workspace/uiTest/WebContent/table1.html. Origin null is not allowed by Access-Control-Allow-Origin.
從網上看到了解決辦法,記下來以備忘:
給chrome加上啓動參數:
--allow-file-access-from-files
就能夠了(須要關閉全部chrome窗口重啓瀏覽器)。