Question

I have a Web App. I have written a Calendar javascript code. A script tag is in body of html code loads that js file from server.

Until writing the last codes, loading page was taking around 900 ms. When I wrote last of my javascript codes, it takes 6 seconds loading the page.

Javascript code basically defines a class for my calendar. It has lots of methods in it. In my last codes, I wrote a new method which is like below:

registerHider = function(){
    alert('hello');

    if(document.addEventListener){
        document.addEventListener('click', hider, false);
    }
};

The method "hider" is another method which just changes "display" style to "none". That's all. When I comment out "addEventListener" code, page loads around 900ms again. But when I uncomment is it takes 6 secs again.

I put there an alert to see if page tries to process any code there on load, but no message comes to screen. From there I understand, codes are not executed yet. Even I changed code to register the event only if document is ready, no help, still same.

What can be the reason of this problem?

Was it helpful?

Solution

All problems are solved. It has turned out that it wasn't about any of those javascript codes.

Lessons learned: If HTTP header's content-length is higher than content's real size;

  1. Firefox waits longer but it still works.
  2. Chrome fails to load the javascript code. So it doesn't work.

Thanks anyway to everybody attended.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top