href 到 asd#zxc.txt (文件名包含数字符号),目标=“_blank”对于IE
我需要在 href 中添加什么内容才能定位到 asd#zxc.txt, 尝试过:
<a href="asd%23zxc.txt" target="_blank">asd#zxc.txt</a>
但 IE 打开 URL 中带有“asd”的新窗口, 这个工作正常:
<a href="asd%23zxc.txt">asd#zxc.txt</a>
但我需要在新窗口中打开文件
Thx
UPD: 也尝试过用JS
window.open("asd%23zxc.txt","_blank")IE opens new window with "asd" only
What I need to put in href for targetting to asd#zxc.txt,
tried:
<a href="asd%23zxc.txt" target="_blank">asd#zxc.txt</a>
but IE opens new window with "asd" in URL,
this one works fine:
<a href="asd%23zxc.txt">asd#zxc.txt</a>
but I need to open file in new window
Thx
UPD:
also tried with JS
window.open("asd%23zxc.txt","_blank")
IE opens new window with "asd" only
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你应该认真考虑更改你的文件名。老实说,我从未见过有人在文件名中使用#。
Firefox 也不支持这个。它会打开一个 URL 中带有 # 的新选项卡,但显示 asd 不存在。
我能看到这个工作的唯一方法是如果你有一个 PHP 脚本来服务该文件。类似于 getfile.php?file=asd#zxc.txt。
即使如此,您可能必须在将请求发送到脚本之前对 # 符号进行编码(我从未通过 POST 或 GET 发送过 # )。另外,请确保对此类脚本设置适当的访问限制。
you should seriously consider changing your filename. honestly, i've never seen anyone use a # in a filename.
Firefox doesn't work with this either. It opens a new tab with the # in the URL but says that asd doesn't exist.
the only way i can see this working is if you had a PHP script serve the file. something like getfile.php?file=asd#zxc.txt.
even then, you might have to encode the # sign before sending the request to your script (i've never sent a # through POST or GET). also, make sure that you set proper access restrictions on a script like that.