문제

I'm developing a BHO to deny access in prohibited websites. So when I find a certain URL, I just open an iframe with the code below:

Document:= IE.Document as IHTMLDocument2;
iFrame:= Document.createElement('iframe');
iFrame.setAttribute('src', 'denied.html', 0);
iFrame.setAttribute('position', 'fixed', 0);
iFrame.style.width:= '100%';
iFrame.style.left:= '0px';
iFrame.style.top:= '0px';
iFrame.style.border:= '0px';
iFrame.style.height:= '100%';
(Document.body as IHTMLDomNode).appendChild(iFrame as IHTMLDomNode);

but this code just opens the iframe into a little space at the end of the website. How to overlap the entire website with the content of my iframe?

도움이 되었습니까?

해결책

Set the position to absolute.

다른 팁

If you want absolutely block - you should not ADD element, you should REPLACE it.

So you have to make full-blown HTML page. Then you probably can redirect browser to it, changing Document.Location property. Or replace older content with new one doing Document.OuterHTML := .... your string.

The rule of thumb is simple - not append by replace, one way or another.

PS: why IE-only BHO that can easily be disabled in browser options ? I'd better ban prohiobited sites via \windows\system32\drivers\etc\hosts or via group policies. Much more reliable.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top