html - 带有 pdf 的 <object> 标签在 firefox 中不起作用,在 IE 中困惑

标签 html css internet-explorer google-chrome firefox

我有这样的对象标签:

<div id="embeddedPdfContainer"><object data="<c:url value="/download-pdf/${id }"/>" id="embeddedPdf"  width="820" height="1135" type="application/pdf"></object></div>

在 chrome 中,这个标签按照我想要的方式工作。在 firefox 中它根本不起作用,在 IE 中它被搞砸了。这是 album在每个浏览器中都有屏幕截图。我在这里有哪些选择?

同样在 firefox 上,我发现这个 pdf 不适用于默认的 firefoxe 的 pdf 查看器。当我选择对 pdf 文档使用 adobe acrobat 扩展时,它工作得很好。

最佳答案

您可以像这样将 pdf 的链接直接写入数据属性:

<div id="embeddedPdfContainer"><object data="/download-pdf/some.pdf" id="embeddedPdf"  width="820"  height="1135" type="application/pdf"></object></div>

我用 Chrome 和 Internet Explorer(不同版本)测试过它,它可以工作

如果您想保留 c:url 选项,您应该将第二个 "更改为 '

所以改变这个:

"<c:url value="/download-pdf/${id }"/>"

进入这个:

 "<c:url value='/download-pdf/${id }'/>"

为了不“转义”字符串

关于html - 带有 pdf 的 <object> 标签在 firefox 中不起作用,在 IE 中困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22534282/

相关文章:

css - Chrome 与 Firefox/IE 中的字体大小不同

javascript - RESTful cookie 路径在 IE 中失败,没有尾部斜线

javascript - jsp如何转义双引号

html - CSS 布局 101 - 在结构化布局中感到困惑

javascript - 当到达 div 时更改 css 类和 jquery 函数

javascript - 如何将鼠标悬停在浏览器的取消按钮上?

javascript - Internet Explorer 不保存打开文件对话框中的路径

html - 如何在 Bootstrap 中拉伸(stretch)容器以适应整个页面

javascript - 如何更改滚动条上的导航栏 css 样式?

javascript - 使用 jQuery 即时创建复选框元素 - 奇怪的 IE 行为