Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the browser wait to end loading the page?

Can anyone explain me why those spaces (marked with ?) are there? They are delaying the page loading. I thought it could be the page/script parsing time, but ~350ms looks too much for a simple page; Okay, there're lots of script, but it still looks to much.

What can it be?

Chrome page speed screenshot

like image 758
Diego Jancic Avatar asked Jul 26 '11 17:07

Diego Jancic


People also ask

Why does page keep loading?

Clear your browser's cache and cookies and restart your web browser. Try a different web browser. This is often due to ad-blockers or other extensions in your browser that might prevent viewing our content. Try turning these off and see if the content loads.

How can I make the browser wait to display the page until it's fully loaded?

To make the browser wait to display the page until it's fully loaded with JavaScript, we run our code in the window. onload method. to set the body element to have opacity 0 initially. window.

How do you stop a page from loading in JavaScript?

Window stop() The stop() method stops window loading. The stop() method is the same as clicking stop in the browser.

How can you tell if a Web page is loaded completely in Uipath?

Hi @Hazem, You can use “Find Element” or “Element Exists” or “On Element Appear” activity with appropriate value in TimeoutMS property. This will happen by default with web UI Automation activities that have WAIT_FOR_READY = Complete . They will execute only after the web page has been fully loaded.


1 Answers

My guess is that it is a JavaScript loading issue. You should be deffering loading of JavaScript using a defer attribute. This will allow the page to load before it will execute the JavaScript code.

This is because browsers are single threaded and when they encounter a script tag, they halt any other processes until they download and parse the script. By including scripts at the end, you allow the browser to download and render all page elements, style sheets and images without any unnecessary delay. Also, if the browser renders the page before executing any script, you know that all page elements are already available to retrieve.

See http://www.hunlock.com/blogs/Deferred_Javascript and http://blog.fedecarg.com/2011/07/12/javascript-asynchronous-script-loading-and-lazy-loading/

like image 177
Dan-Dev Avatar answered Sep 28 '22 07:09

Dan-Dev