<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <script> function setHeight(){ var height = document.documentElement.scrollHeight; var width = document.documentElement.scrollWidth; document.getElementById("dialog_iframe").height= height; document.getElementById("dialog_iframe").width= width; } window.onload=setHeight; </script> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>调用页面</title> <style type="text/css"> body,html{ overflow:hidden; } </style> </head> <body > <div height="100%" style="margin:-16;"> <iframe id="dialog_iframe" src="目标地址" frameborder="0"></iframe> </div> </body> </html>
IFrame宽高度设置与浏览器一致,
body,html{
overflow:hidden;
} 保证调用页面的滚动条隐藏,防止出现调用页面与被调用页面同时出现滚动条的情况。
另,<script>放在<!DOCTYPE html后,可让浏览器默认选择杂项(兼容)模式
时间: 2024-10-01 23:31:52