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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:46:21+00:00 2026-06-12T06:46:21+00:00

I am trying to display HTML files (containing local images) in a WebBrowser control.

  • 0

I am trying to display HTML files (containing local images) in a WebBrowser control. User can select the file using an OpenFileDialog, after which it is displayed in the control.

But I have these problems I am struggling to solve:

  1. Since I’ve added the control to my Form, it’s been loading really slowly. It takes almost 10s for the form to instantiate.

  2. WebBrowser.Navigate only works the first time. When I try to load the second file, nothing happens. I have tried calling Refresh, Update, OpenNew, opening about:blank between two files, but I just don’t have a clue how to do it properly. Only the initially opened file remains shown, no exceptions or warnings ever pop up when I try to navigate to a different page.

Am I doing something wrong? For example, Lutz Roeder’s Writer starts instantly and loads subsequent files without problems, but it uses lots of interop (and is editable), so I am trying to avoid all that stuff.

  • 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-12T06:46:22+00:00Added an answer on June 12, 2026 at 6:46 am

    The way I have been loading local .html files into a WebBrowser is like so:

    OpenFileDialog ofd = new OpenFileDialog();
    // Do filtering here
    if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        webBrowser1.DocumentText = System.IO.File.ReadAllText(ofd.FileName);
    }
    

    It can load files one after another with no problems. If you are trying to load a big html file when the form is initializing or is opening this could explain the 10 second loading time. My form loaded almost instantly when it had a WebBrowser control on it.

    Hope this helps!

    Edit: Try setting the stream of the WebBrowser:

    System.IO.Stream s = System.IO.File.OpenRead(ofd.FileName);
    webBrowser1.DocumentStream = s;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to display some files in a web page so the user can
I am trying to display images using an HTML page created by a servlet.
I'm trying to get an html page to display an XML file formatted with
I'm trying to display some large images with HTML img tags. At the moment
I'm trying to display some HTML files that have code samples, surrounded by codeblock
Greetings! I've been trying to display some HTML with Java using JEditorPane . But
I'm trying to display a page of html using bottle (the python web framework).
Alright, I'm trying to display an image thumbnail using the File API and jQuery.
I want to display a file content (HTML file) inside a web page using
I'm trying to display HTML source code in my NSDocument based application. However, it

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.