0

禁止されているURLへのアクセスを拒否するBHOを開発しています。そのため、ターゲットURLを見つけたら、ナビゲーションをキャンセルして、別のdenied.htmlへのiframeを開きます。しかし、何らかの理由でこのiframeの高さは100%ではありません。ページの20%のように表示されます。iframeを作成するためのコードは次のとおりです。

  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%の高さではないことが原因である可能性があるため、テスト用に実行しましたが、機能しません。誰かが私のための解決策を持っていますか?

4

1 に答える 1

0

html と body の両方を 100% に設定します

html, body { height : 100% }
于 2012-08-17T14:50:24.827 に答える