URL 在 IE9 地址栏中粘贴/输入时有效,但在 href 或 window.open 中无效
上下文:这是内联网系统的一部分,需要基本身份验证并运行只能在我们的工作域内访问的内部服务器。
因此,情况是 IE9 将跟踪网络文件和网络文件的链接。文件夹,通过映射驱动器没有任何问题。我已经得到了这个工作正常,一种仅适用于 IE 的安全漏洞,非常适合我们的情况和许多其他情况:)
例如: 示例
工作正常。 现在,问题在于 示例
不起作用。
但是如果我复制并粘贴 file:///C:/foo/bar.txt
到地址栏,它加载得很好。 本地文件夹也是如此。
另一点需要注意的是,我尝试过 Example< ;/a>
并经历了完全相同的结果。指向文件的 URL 和网络映射驱动器上的文件夹工作正常,C:\ 文件夹和文件不起作用(除非粘贴到地址栏中)。
所以我的问题是:
1.考虑到我有一个有效的URL,为什么IE9在点击时不跟随它,但在输入地址栏时会跟随它?
2。为什么 IE 可以毫无顾虑地启动网络文件和网络文件?文件夹,但不是本地文件夹?
3。我怎样才能让它发挥作用? (我会毫不犹豫地使用任何必要的肮脏的 IE 黑客技术)
回答其中任何一个问题都很好,但是金星奖颁给了能够回答第 3 个问题的人!
我怀疑/希望这只是我的谷歌搜索无法发现的某个地方的一个模糊的安全设置。
感谢您的宝贵时间&希望这对有经验的人敲响警钟之前解决了这个问题:)
编辑:我刚刚注意到 IE9 正在重新解释我的链接!如果我查看源代码并看到: Example
或 示例
,当我将鼠标悬停在链接上或复制快捷方式时,我得到文件:///C:/foo/bar.txt
。所以我认为我正在与试图形成“正确”URL 进行一场艰苦的战斗。我确信这不是代码语法错误,而是某个地方的设置可以启用这些 C: 链接。
Context: this is part of an INTRANET system, requiring basic authentication and running off an internally facing server accessible only within our work domain.
So, the situation is that IE9 will follow links to network files & folders, via mapped drives without any problem. I've got this working fine, a kind of IE only security exploit which works perfect for our situation and many others :)
For example:<a href="file:///U:/foo/bar.txt" target=\"_new\">Example</a>
works fine.
Now, the problem is that <a href="file:///C:/foo/bar.txt" target=\"_new\">Example</a>
won't work.
However if I copy and paste file:///C:/foo/bar.txt
into the address bar, it loads fine. And same goes for local folders.
Another point to note is that I've tried with <a href="#" onclick="window.open('file:///C:/foo/bar.txt');">Example</a>
and experienced the exact same results. URLs pointing to files & folders on network mapped drives work fine, C:\ folders & files don't work (unless pasted into address bar).
So my questions are:
1. considering I have a valid URL, why won't IE9 follow it when clicked, but will follow it when entered into the address bar?
2. Why does IE have no qualms about launching network files & folders, but not local ones?
3. How can I get this working? (and I have no hesitation to use any dirty IE hack necessary)
An answer to any 1 of these questions would be great, but gold star goes to the person who can answer #3!
I'm suspecting/hoping it's simply an obscure security setting somewhere which my googling hasn't been able to unearth.
Thanks for your time & hope this rings a bell with someone who has experienced & solved this issue before :)
edit: I've just noticed that IE9 is re-interpreting my links!! If I view source code and see: <a href="C:/foo/bar.txt" target="_new">Example</a>
or <a href="file://C:/foo/bar.txt" target="_new">Example</a>
, when I hover over the link, or copy the shortcut, I get file:///C:/foo/bar.txt
. So I think I'm fighting an uphill battle with trying to form the "correct" URL. I'm sure this is not a code-syntax error, but a setting somewhere to enable these C: links to be followed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法复制您的问题。我可以使用以下命令在 Chrome 和 IE 中打开页面:
和:
I haven't been able to replicate your issue. I'm able to open up pages in both Chrome and IE using both:
and: