IE 以外的浏览器不支持 javascript 和 iframe

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13523260/
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-10-26 19:02:17  来源:igfitidea点击:

javascript and iframe not supported in browsers other than IE

javascripthtmliframesafaricross-browser

提问by Iyalarasi.R

I run a simple html file with an iframe and javascript working fine in IE Browser, but it is not working in other browsers like safari,firefox.

我在 IE 浏览器中运行一个带有 iframe 和 javascript 的简单 html 文件,但它在其他浏览器(如 safari、firefox)中无法正常工作。

In safari the Iframe box is only displayed, but the content in that is not shown.

在safari 中只显示Iframe 框,但不显示其中的内容。

Please clarify why safari doesn't support it? what are the alternatives for iframe?

请澄清为什么 safari 不支持它?iframe 的替代方案是什么?

回答by ameya rote

You can use <embed>tag ,which behaves like iframe

您可以使用<embed>tag ,其行为类似于 iframe

Here is example

这是例子

<!doctype html >
<html >
<head>
<title>embed  Tag </title>
</head>
<body>
<p><b>Example of embed tag in HTML5.</b></p>
<embed src="http://www.w3schools.com" height="300" width="300" />
</body>
</html>

While you can also use iframes on all browser

虽然您也可以在所有浏览器上使用 iframe

Here is example

这是例子

<!DOCTYPE html>
<html>
<body>

<iframe src="http://www.w3schools.com">
  <p>Your browser does not support iframes.</p>
</iframe>

</body>
</html>

Are you trying to do any different for iframe ?

你想对 iframe 做任何不同的事情吗?