Questions tagged [domcontentloaded]

DOM event The DOMContentLoaded event is fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading (the load event can be used to detect a fully-loaded page).

124 questions
2
votes
1 answer

My layout phase of initial page load is taking more than 2 seconds

Even though my DOMContentLoaded event is fired at ~500ms, the first paint happens around 3.5s due to a very long layout phase. Can anyone advise me as to why this might be happening, and how I can fix it? Currently the page does have ~350 nodes,…
2
votes
1 answer

Element selector returning null even after "DOMContentLoaded"?

I'm having some difficulty here with getElementById returning a null object. All of the below code has been placed inside an anonymous function that is called when "DOMContentLoaded" (event listener). I did this to avoid getElementById not being…
2
votes
2 answers

css3 transition does not trigger on DOMContentLoaded

Consindering the following simple example, I wonder why CSS3 transition effect is not triggered when using DOMContentLoaded? Using window.onload or document.onreadystatechange = "complete" will work! I know that DOMContentLoaded does not wait for …
Okyo
  • 357
  • 4
  • 17
2
votes
2 answers

Display full page image after image is loaded

How do I display a image only after it loads but the rest of the page shows normally? On each page I have something like this and the css is as follows html.page-name { background: url(images/page-name.jpg) no-repeat center…
user2513485
  • 25
  • 1
  • 4
2
votes
1 answer

Is "document ready" supposed to work like this on IE?

I'm making a small javascript framework, for a variety of reasons, including learning. Hence, I wanted to implement "document ready" functionality, and so I went to check how jQuery fakes DOMContentLoaded on IE < 9. Problem is, it doesn't seem to be…
Camilo Martin
  • 37,236
  • 20
  • 111
  • 154
1
vote
0 answers

waitForLoadState('networkidle') does not work in Playwright

For fully page loading I have used waitForLoadState('networkidle'). It works before but for now randomly error 'Error: page.waitForLoadState: Navigation failed because page was closed!' appeared after test run. What is the alternative for…
1
vote
1 answer

Run two separate functions on DOMContentLoaded

I have a website which has two files; main.js and loading.js loading.js waits for DOMContentLoaded, then clears a loading screen cover. main.js also waits for DOMContentLoaded, but also waits for loading.js to finish its DOMContentLoaded, then…
notsoscottishscot
  • 350
  • 1
  • 4
  • 11
1
vote
0 answers

DOMContentLoaded making the webpage slow

I'm using DOMContentLoaded to load an initial item when webpage load. After using this when my webpage loads the CSS loads first and after the interval of 1-2 sec the JS loads the initial item. Is this because of the DOMContentLoaded event or…
user16830524
1
vote
1 answer

how to wait for load newly created elements - puppeteer

I want to get the sizes of the product from the adidas.com site using Puppeteer. The sizes are not loaded in the initial loading and the HTML code is as follows:
mohsen
  • 11
  • 1
1
vote
1 answer

How does YouTube's dynamic loading on the homepage work?

I'm making an extension that will put a button under each video on the home page but I found out very quickly that this wouldn't be possible by just using a selectAll statement. The only thing that a selectAll statement does is it retrieves the…
1
vote
1 answer

Waiting with page load until method finished

The Javascript of my webpage is executing the code shown below when a webpage is loading. The call to get can take a couple of seconds, thus I would like to wait with loading the page until the call is finished. Is it possible to postpone the…
BlackHawk
  • 719
  • 1
  • 6
  • 18
1
vote
1 answer

Calculate DomContentLoaded

I want to be ensure about the equation of DomContentLoaded time in seconds? This equation can help me ? DomContentLoaded = performanceTiming.domContentLoadedEventEnd - performanceTiming.navigationStart
Weam Jalal
  • 11
  • 1
1
vote
0 answers

How can I fadeout my preloader after all contents of my website (including images, videos etc.) has been loaded?

I want to use a preloader animation for my website and want it to fadeout after my site's all content has loaded. I have tried this way: