php 页面未在 IE11 中的 iframe 内加载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21695191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 04:22:58  来源:igfitidea点击:

page is not loading inside the iframe in IE11

phpjqueryhtml

提问by Ayesha

I have following code. I wanted to load the page inside an iframe. But it is showing only loader into an iframe. i have this problem only in IE 11. In all the browser it is working fine.

我有以下代码。我想在 iframe 中加载页面。但它只显示加载到 iframe 中。我只在 IE 11 中有这个问题。在所有浏览器中它都运行良好。

<iframe src="https://docs.google.com/viewer?url=http://localhost/test_energy/img/Sample.pdf&embedded=true" width="570" height="300" style="border: none;">
</iframe>

回答by hizbul25

try:

尝试:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 

回答by mattts

First try removing the semicolon ";" from your initial code

首先尝试删除分号“;” 从您的初始代码

<iframe src="https://docs.google.com/viewer?url=http://localhost/test_energy/img/Sample.pdf&embedded=true" width="570" height="300" style="border: none;">;<- Remove this

;<- Remove this

;<- 删除这个

and then try e.g. should work fine

然后尝试例如应该可以正常工作

<iframe src="https://docs.google.com/viewer?url=http://tobi.oetiker.ch/lshort/lshort.pdf&embedded=true" width="570" height="300" style="border: none;"></iframe>

回答by OMengi

Add a function called attachEvent inside the iframe ..like this (before jQuery script tag in IFRAME):

在 iframe 中添加一个名为 attachEvent 的函数..像这样(在 IFRAME 中的 jQuery 脚本标记之前):

var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));

if (isIE11) {
  if (typeof window.attachEvent == "undefined" || !window.attachEvent) 
  window.attachEvent = window.addEventListener; 
}