【发布时间】:2016-03-15 13:53:18
【问题描述】:
我无法打开本地文件,同时我使用“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --disable-web-security --allow-file-access-from-我的谷歌浏览器快捷方式上的文件。 资源管理器提示安全模式已关闭,我可以使用 js 或 href 属性打开一个新窗口。 但问题是:为什么每次我点击href,它总是打开一个空白页面,没有任何显示。所以..
function copyUrl(obj)
{
var href = $(obj).attr("hreff");
var hideInput = $("#hidInputHref");
hideInput.val(href);
hideInput.select();
try
{
document.execCommand('copy');
var opener = window.open('file:////C:/windows');
// opener.document.write("<iframe src='c:\' width='100%' height='100%'></iframe>");
//var test = "<body><script>" +
// "alert(1);console.log(1);"
//"<" + "\/script><div>11111111111</div></body>";
////var stateObj = { foo: "bar" };
//opener.document.write(test);
//opener.history.pushState("", "page 2", "./a.html");
//opener.location.href = "www.baidu.com";
//opener.location.reload();
opener.opener.location.href = "C:\windows";
}
catch (err)
{
console.log(err);
}
}
C#代码:
partsQueryList[i].ImageRefLink = "<a onclick='copyUrl(this)' hreff='" + "C:\\" + "' ><font color='blue'>ImageRefLink</font></a>";
顺便说一句,当我尝试使用 pushSate 方法时,它可以将新 url 推送到新窗口,但它不能解决跨域问题。所以...我该如何解决呢?谢谢!
【问题讨论】: