• Welcome to PlanetSquires Forums.
 

CWebCtx and timeout on navigate

Started by Paul Squires, October 27, 2018, 11:19:16 AM

Previous topic - Next topic

Paul Squires

Hi Jose,

I may not be using the control correctly so please forgive me if my understanding is wrong. I implemented the code into WinFBE and everything seemed to work well except that the first page loads would time out (returns a value of 1 indicating object failed to initialize until the timeout of 10 seconds). The second page load seemed to load after about 8 seconds or so. Subsequent pages loaded almost instantly until eventually I would click on another page to load and it would hang for a while again. Strange.

I ripped the code out of WinFBE and created a bare minimum test program in order to show you. Hopefully the same problem will show on your computer as well. The program is basically a Treeview that recursively loads HTML versions of all of your Markdown help files. Clicking on the Treeview nodes will load the name of the specified HTML file.

Can you shed some light on this? Should I be checking other properties of the browser control (busy state, initialization, etc).

(Code and exe attached in rar archive).

Thanks!
 
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#1
I suspect that it is caused by the antivirus software (in my case Windows Defender).


Paul Squires

Quote from: José Roca on October 27, 2018, 12:10:37 PM
I suspect that it is caused by the antivirus software (in my case Windows Defender).

I also only use Windows Defender. I turned off all virus protect (real time, cloud based, etc) and the problem was still there. I'll try a few other things to see if it makes any difference.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

I don't know. If I save a web page, like this one, there is no delay.

Joerg B.

Hello Paul
I can confirm the problem.
I am using Kaspersky Internet Security.  Whether I quit the software or have it active makes no difference to me.
I wait up to 17 seconds for the content to be displayed.
Greeting from Germany

Joerg

Paul Squires

Thanks Joerg, I appreciate you confirming the problem. I wonder if it is something in the generated HTML that is causing the slowdown because Jose points out that other HTML seems to work okay. Obviously I won't implement this type of help system into WinFBE if the wait times are this long.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Hi Paul,
Similar delay on my Windows 10, BitDefender machine.


Interesting that rapid, multiple clicks on the tree will eventually work and display the correct page but with an initial delay. To your code I added ? "a", ? "b" before every line of code (a through m). With multiple clicks on the tree, once the initial delay expired and all the pages rapidly displayed, the Console displayed as per the attached image.


It turns out the delay is at the end of the rapid clicks.


This is the line of code just after ? "k"

pwb->SetFocus
Clive Richey

SeaVipe

Hi Paul,


Using different code (example code in WinFBX) I see that this HTML code has an impact on file load time:




  <!--[if lt IE 9]>
  <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->



The browser is being interpreted as IE9
Clive Richey

Paul Squires

Hi Clive, great catch there buddy - thanks! Yes, it certainly does appear that could be the bottleneck. I downloaded the javascript code directly from https://github.com/aFarkas/html5shiv and put it in the same folder as the html file. I then modified the html file as follows and the loads were almost instantaneous.

  <!--[if lt IE 9]>
    <script src="html5shiv-printshiv.min.js"></script>
  <![endif]-->
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

I updated my conversion tools to modify the html code to point to a local copy of the javascript file. I have attached a new rar archive with all of the new files. It appears to load very quickly now. Please let me know if it is also fast for you. Thanks!
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

The solution seems to be:

To add

  <meta http-equiv='X-UA-Compatible' content='IE=edge' />
  <meta http-equiv='MSThemeCompatible' content='Yes'>

in the head section

and remove

  <!--[if lt IE 9]>
    <script src="html5shiv-printshiv.min.js"></script>
  <![endif]-->

Thanks to Microsofot infinite wisdom, the embedded WebBrowser control emulates IE 7.

Adding

  <meta http-equiv='X-UA-Compatible' content='IE=edge' />

to the web page forces to use the latest IE installed without emulating IE 7.

The purpose of the html5shiv-printshiv.min.js script is to add support for HMTL5 to older versions of IE by parsing the DOM and modifying it.

Paul Squires

Wow, thanks Jose! I will pivot my course and update the html's using your code. That will be faster and cleaner than loading the javascript, etc.
:)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Paul, Your current version works very fast.

I'll look again after the next update.
Clive Richey

Paul Squires

I have updated my tools to create html files based on Jose's suggestion to add the "X-UA-Compatible" meta tag. Seems to work very well and fast. I have attached the new files.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

It is very annoying that now that HTML5 is mainstream, the embedded WebBroser control still emulates IE 7. If we build the web page, we can use the meta tag workaround, but we are powerless when we load a web page from internet. In this case, the only thing that we can do is to modify a registry setting.