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 7178475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:55:43+00:00 2026-05-28T16:55:43+00:00

I building a C# application with a WebBrowser control in it and and I

  • 0

I building a C# application with a WebBrowser control in it and and I am trying to figure out a way to get the flash content within the web page to not display as it is sucking up a ton of my CPU and memory. I’ve been trying to remove the <object> tag within the page (there’s only one) by getting it via browser.Document.GetElementsByTagName(“object”) and setting its outerHtml to an empty string. It returns one element (confirmed by the Count property) but accessing the first element ([0]) gives an index out of range error. I’ve tried doing it via a foreach loop but nothing happens at all and there are no errors. If I try to retrieve <div> elements instead of <object> elements, the foreach loop runs. Am I doing something wrong here, is there a bug, or is there a better way to remove the flash content? Any help greatly appreciated.

My code:

HtmlElementCollection flashElements = webBrowser.Document.GetElementsByTagName("object");
foreach (HtmlElement element in flashElements)
{
  element.OuterHtml = "";
  MessageBox.Show("Deleted");
}

By the way, this is being run after the DocumentCompleted event has been fired.

EDIT: I just figured out that while the DocumentCompleted event is being called, it is being called before JavaScript injects the flash content onto the page. I’ve tried a few “sleeping”-like methods but they all stop the web page from processing too. Any way to wait for more time (5 seconds or so) while the webpage continues to render?

  • 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-05-28T16:55:44+00:00Added an answer on May 28, 2026 at 4:55 pm

    Option 1:
    You could use a System.Threading.Timer to try and wait extra time for the dynamically injected Flash. That shouldn’t hold up the WebBrowser from running while you wait.

    Option 2:
    Try something like FiddlerCore (you would add this to your app), privoxy (this would run outside of your app on your local machine) or some other proxy to actually block the Flash (.swf) content from ever getting to your local machine. With FiddlerCore, you would monitor each web request/response and kill the request/response based on the HTTP content type, for instance. This option would incur the CPU/memory hit of proxying the network, but is still likely less than the Flash is using itself.

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

Sidebar

Related Questions

I'm building a Windows Forms application which makes use of the WebBrowser control. Can
Building an application with a database that has the ability to get big not
I'm trying to figure out the best way to store large binary (more than
I am building an application which opens a website in WebBrowser control and then
I am building an application where a page will load user controls (x.ascx) dynamically
When building an application, i get a warning: 2011-11-03 00:00:22.405 UnblockMe[26904:f803] Unknown class PuzzleView
When building my application in release mode, I get an internal error URW1135 at
I'm building a Django web service that is called from an application. When it
im building an application which loads some products on main page with search.also after
I am building an application in .NET (not important what language, it is a

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.