سؤال

I'm developing a BHO to deny access on prohibited URLs. So when I find some target URL, I just cancel navigation and open an iframe to another denied.html. But the height of this iframe for some reason isn't 100%. It appear in like 20% of the page. The code to create the iframe is:

  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;

I'm using live.com for testing purposes. and the line:

Document.body.style.height:= '100%';

is because I already read on internet that this problem maybe is because the html is not at 100% height, so I did it for test but continue not working. Someone have a solution for me??

هل كانت مفيدة؟

المحلول

Set the html and body both to 100%

html, body { height : 100% }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top