Javascript 打开针对 PDF 的新窗口
我有一个链接的下拉框,它将一组字符串中的下载字符串拼凑在一起...
例如,
string1 = "a4";
string2 = "_landscape";
string3 = "_lovely";
string4 = ".pdf";
totalString = string1 + string2 + string3 + string4;
window.open(totalString);
这在 FireFox 中很有效,但在 IE 中,我在原始窗口中收到以下错误(即使 PDF 在新窗口中打开) ):
405 - 用于访问此内容的 HTTP 动词 页面不允许。你所在的页面 寻找的内容无法显示 因为方法无效(HTTP 动词) 用于尝试访问。
我有一种感觉,这是基于“标题”的,但我不是 100% 确定 - 有人可以帮忙吗?
干杯!
I have a chained dropdown box that pieces together a download string from a group of strings...
e.g.
string1 = "a4";
string2 = "_landscape";
string3 = "_lovely";
string4 = ".pdf";
totalString = string1 + string2 + string3 + string4;
window.open(totalString);
This works a treat in FireFox, but in IE I get the following error on the original window (even though the PDF opens in a new window):
405 - HTTP verb used to access this
page is not allowed. The page you are
looking for cannot be displayed
because an invalid method (HTTP verb)
was used to attempt access.
I have a feeling that this is "Headers" based, but I'm not 100% sure - can anyone help?
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这听起来像是您正在
POST
来自 HTML 页面的数据。上周我在将 Facebook 数据发布到 HTML 页面时遇到了类似的问题,并收到了相同的错误消息。确保您的代码或任何AJAX
发布数据中没有任何This sounds like you are
POST
ing data from a HTML page. I had a similar issue last week with posting data from Facebook to a HTML page and had the same error message. Make sure that you don't have any<form>
tags in your code or anyAJAX
posting data.尝试使用以下格式构建完整的 URL http://www.example.com/path/a4_landscape_lovely.pdf 。
Try constructing the full URL with the format http://www.example.com/path/a4_landscape_lovely.pdf.