I have a code that executes some lines of code on document ready or window load. My problem is that sometimes the code works and sometimes not. I see that if i press the refresh button on the browser, always work well. But when I enter to the page from other page using href, sometimes work and sometimes not. I try with cache disabled, link follow by parameter, use full url, but nothing works.
When works, works well, but there is sometimes that doesn't work. I notice that when the network is a little slow, the problem is frequent. But with the refresh always work, any idea?
My page works with jquery and angular js. The thing that most intrigue me is why sometimes work and sometimes don't!
When I enclose the document ready in a setTimeout function and gives a time of 1 or 2 seconds then works