我正在开发一个BHO来拒绝访问被禁止的URL。因此,当我找到一些目标网址时,我只需取消导航并将iframe打开到另一个denied.html。但由于某种原因,此iframe的高度不是100%。它出现在20%的页面中。创建iframe的代码是:为什么身高不是100%?
if pos('live.com', URL) > 0 then
begin
Cancel:= true;
Document:= IE.Document as IHTMLDocument2;
Document.body.innerHTML:= '';
Document.body.style.height:= '100%';
iFrame:= Document.createElement('iframe');
iFrame.setAttribute('src', 'denied.html', 0);
iFrame.setAttribute('position', 'absolute', 0);
iFrame.style.height:= '100%';
iFrame.style.width:= '100%';
iFrame.style.left:= '0px';
iFrame.style.top:= '0px';
iFrame.style.border:= '0px';
(Document.body as IHTMLDomNode).appendChild(iFrame as IHTMLDomNode);
end;
我使用live.com进行测试。而行:
Document.body.style.height:= '100%';
是因为我已经在互联网上阅读,这个问题也许是因为HTML不是100%的高度,所以我做了测试,但继续不工作。有人有我的解决方案?
边注:如果该网站是foobarlive.com,它仍然会通过? – epascarello 2012-08-17 14:49:49
仍然认为你最好用重定向而不是“iframe”覆盖。 'iframe'可能会占用'body'和'html'元素的高度;设置'最小高度:100%;'可能工作,不确定与IE。 – 2012-08-17 14:51:35