newbie newbie - 1 year ago 57
Javascript Question

How to pop up some contents before page load javascript

I have a script that invoke pageLoad after all content is loaded.

I need it to be on before page load

my script is

function pageLoad()

window.onload = pageLoad;

Can anyone do anything this script to get show on before load page?

Thanks very much

Answer Source

The onreadystatechange event is fired on a HTML document when the load state of the page's content has changed.

document.onreadystatechange = function()
    if (document.readyState === 'complete')
window.onload = function(e)