我如何(跨浏览器兼容)最大化iFrame,使其看起来像URL栏中的页面,即使它是从不同的服务器提供的?
我想这应该有效:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test page!</title>
<style type="text/css">
html, body {
overflow: hidden;
margin: auto;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<iframe src="page.htm" width="100%" height="100%" frameborder="0"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
编辑1:您可以隐藏页面的滚动条,使用HTML和scroll = no指令
(该解决方案应该是多浏览器)
编辑2:现在甚至XHTML证明;)
编辑3:最后w3验证器确定
(如果在Internet Explorer兼容性问题中运行,请务必在BODY中添加scroll = no)