Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. WebBrowser control

WebBrowser control

Scheduled Pinned Locked Moved IT & Infrastructure
c++htmlsysadmintutorialquestion
14 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Sanjeev Kumar

    I am using WebBrowser control in VC++ project. WebBrowser loads page form Intranet Server. I don't want to show message like "The page cannot be displayed" in case server is down. I want to show some local html page which will be stored on client computer. Does anyone know how to catch event when page is not successfully loaded from server? Thanks Sanjeev.

    J Offline
    J Offline
    Jason Henderson
    wrote on last edited by
    #4

    The page cannot be displayed message is a resource in IE, so you can't change it directly. I'm not sure DownloadComplete or DocumentComplete would be fired until after the error page is loaded. You may have to send an http request to the server first to see if it returns an error, then show your page. Like it or not, I'm right.

    N 1 Reply Last reply
    0
    • C ColinDavies

      Like Mark said but I'd use the DocumentComplete Event in case frames are being used instead. I actually like to verify with the changing Title text as well, for more specific errors. Regardz Colin J Davies

      Sonork ID 100.9197:Colin

      More about me :-)

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #5

      From MSDN: DocumentComplete event when the document has completely loaded and the READYSTATE property has changed to READYSTATE_COMPLETE. NavigateComplete2 The document might still be downloading (and in the case of HTML, images might still be downloading), but at least part of the document has been received from the server, and the viewer for the document has been created. The latter method would allow you to determine if the correct page were loaded(or loading) without having to wait for the READY_STATE to be set. You'll also note from the documentation that NavigateComplete2 is used for frames also.

      1 Reply Last reply
      0
      • J Jason Henderson

        The page cannot be displayed message is a resource in IE, so you can't change it directly. I'm not sure DownloadComplete or DocumentComplete would be fired until after the error page is loaded. You may have to send an http request to the server first to see if it returns an error, then show your page. Like it or not, I'm right.

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #6

        Jason Henderson wrote: Like it or not, I'm right. Like it or not your wrong. Using the NavigateComplete2 method you do not need to send a request first to see if an error occurs. In my opinion that would be a very poor technique. Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page.

        S J 5 Replies Last reply
        0
        • N Not Active

          Jason Henderson wrote: Like it or not, I'm right. Like it or not your wrong. Using the NavigateComplete2 method you do not need to send a request first to see if an error occurs. In my opinion that would be a very poor technique. Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page.

          S Offline
          S Offline
          Sanjeev Kumar
          wrote on last edited by
          #7

          >Depending on the server configuration, error messages can be changed so it >is possible from that end to change the 404 error page. what if server is not responding??? NavigateComplete2 method is called after the document is loaded (and displayed). I don't want the "error page" to be displayed at all.

          N 1 Reply Last reply
          0
          • N Not Active

            Jason Henderson wrote: Like it or not, I'm right. Like it or not your wrong. Using the NavigateComplete2 method you do not need to send a request first to see if an error occurs. In my opinion that would be a very poor technique. Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page.

            J Offline
            J Offline
            Jason Henderson
            wrote on last edited by
            #8

            Mark Nischalke wrote: Like it or not your wrong. Apparently, you don't like my sig. You're not the first. ;P Like it or not, I'm right.

            1 Reply Last reply
            0
            • N Not Active

              Jason Henderson wrote: Like it or not, I'm right. Like it or not your wrong. Using the NavigateComplete2 method you do not need to send a request first to see if an error occurs. In my opinion that would be a very poor technique. Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page.

              J Offline
              J Offline
              Jason Henderson
              wrote on last edited by
              #9

              Mark Nischalke wrote: Like it or not your wrong. Apparently, you don't like my sig. You're not the first. ;P Mark Nischalke wrote: In my opinion that would be a very poor technique. It was just an idea because, at the time I did not know what event to use. Like it or not, I'm right.

              1 Reply Last reply
              0
              • N Not Active

                Jason Henderson wrote: Like it or not, I'm right. Like it or not your wrong. Using the NavigateComplete2 method you do not need to send a request first to see if an error occurs. In my opinion that would be a very poor technique. Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page.

                J Offline
                J Offline
                Jason Henderson
                wrote on last edited by
                #10

                Mark Nischalke wrote: Like it or not your wrong. Apparently, you don't like my sig. You're not the first. ;P Mark Nischalke wrote: In my opinion that would be a very poor technique. It was just an idea because, at the time I did not know what event to use. Mark Nischalke wrote: Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page. This is not what he wants. Like it or not, I'm right.

                1 Reply Last reply
                0
                • N Not Active

                  Jason Henderson wrote: Like it or not, I'm right. Like it or not your wrong. Using the NavigateComplete2 method you do not need to send a request first to see if an error occurs. In my opinion that would be a very poor technique. Depending on the server configuration, error messages can be changed so it is possible from that end to change the 404 error page.

                  J Offline
                  J Offline
                  Jason Henderson
                  wrote on last edited by
                  #11

                  Whoa, that was wierd. Like it or not, I'm right.

                  1 Reply Last reply
                  0
                  • S Sanjeev Kumar

                    I am using WebBrowser control in VC++ project. WebBrowser loads page form Intranet Server. I don't want to show message like "The page cannot be displayed" in case server is down. I want to show some local html page which will be stored on client computer. Does anyone know how to catch event when page is not successfully loaded from server? Thanks Sanjeev.

                    J Offline
                    J Offline
                    Jason Henderson
                    wrote on last edited by
                    #12

                    I think the NavigateError event is what you need. new window Like it or not, I'm right.

                    S 1 Reply Last reply
                    0
                    • J Jason Henderson

                      I think the NavigateError event is what you need. new window Like it or not, I'm right.

                      S Offline
                      S Offline
                      Sanjeev Kumar
                      wrote on last edited by
                      #13

                      Like it or not, u'r right. ;) Thanks for the answer ! I guess it should solve my problem..

                      1 Reply Last reply
                      0
                      • S Sanjeev Kumar

                        >Depending on the server configuration, error messages can be changed so it >is possible from that end to change the 404 error page. what if server is not responding??? NavigateComplete2 method is called after the document is loaded (and displayed). I don't want the "error page" to be displayed at all.

                        N Offline
                        N Offline
                        Not Active
                        wrote on last edited by
                        #14

                        Read the above reply when the NavigateComplete event is recieved the page can still be downloading elements.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups