Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7768299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:53:07+00:00 2026-06-01T15:53:07+00:00

I want to prevent iframe elements from triggering the OnDocumentComplete event every time. For

  • 0

I want to prevent iframe elements from triggering the OnDocumentComplete event every time. For example, a page has 4 iframes, and when I load this page, my OnDocumentComplete event runs 4 times. I want to run OnDocumentComplete just once for every page. How can I do that?

Maybe I could remove or block iframes in TWebBrowser control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:53:09+00:00Added an answer on June 1, 2026 at 3:53 pm

    The event OnDocumentComplete is fired for each FRAME/IFRAME in the main document.
    If you want to ignore them try this:

    procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
      const pDisp: IDispatch; var URL: OleVariant);
    begin
      // check that the event is raised for the top-level browser (not frames or iframes)
      if pDisp = TWebBrowser(Sender).ControlInterface then
      begin
        // do something nice...
      end;
    end;
    

    From Delphi Docs:

    Write an OnDocumentComplete event handler to take specific action when a frame or document is fully loaded into the Web browser. For a document without frames, this event occurs once when the document finishes loading. On a document containing multiple frames, this event occurs once for each frame. When the multiple-frame document finishes loading, the Web browser fires the event one final time.

    Sender is the Web browser that is loading the document.

    pDisp is the Automation interface of the top-level frame or browser.
    When loading a document without frames, pDisp is the interface of the
    Web browser. When loading a document with multiple frames, this is the
    interface of the containing frame, except for the very last time the
    event occurs, when it is the interface of the Web browser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to prevent my iframe from being cached. The first page isn't a
I want to prevent users from voting more than one time in my website,
I want to prevent the user from maximizing the Windows Form to full screen
I want to prevent my asp.net / c# 2008 web pages from being cached
I want to prevent users from commenting on deleted threads. I've set a variable
What solutions do I have if I want to prevent the UI from freezing
Let's say I've got a control and I want to prevent it from being
I created a custom event called slides.swap but I want to prevent the event
i want prevent eventpropogation from element inside an anchor tag i m trying to
I have an iframe (with designMode set to on) within a page that has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.