用window.open()不能打開本地鏈接嗎?比如像計算機中的某個js文件
慕粉13727861792
2017-01-23 18:24:04
TA貢獻3593條經驗 獲得超0個贊
TA貢獻319條經驗 獲得超234個贊
onclick="window.open('C:\\Documents?and?Settings\\Administrator\\桌面\\index.html');"
沒有問題呀
TA貢獻1條經驗 獲得超0個贊
open方法現在會被瀏覽器阻止,你可以這樣實現
var a = document.createElement("a");
? ? a.setAttribute("href", ‘xxx.html’);
? ? a.setAttribute("target", "_blank");
? ? a.setAttribute("id", "openwin");
? ? document.body.appendChild(a);
? ? a.click();
舉報