Load Javascript Alert while the page is loading


Im wondering if its possible to load a JavaScript alert before the content while the page is loading

Whatever I try to do the alert fires and the page doesn’t load until the alert is closed

alert('But wait, there\'s more...');

Well, you can use a page-listener to do this. Something like this should work:

<script type="text/javascript">
document.onreadystatechange = function() {
    if(document.readyState=='loaded' || document.readyState=='complete')
        alert('But wait, there\'s more...');

Or, if you are using Bootstrap on your site, you could use a modal pop-out which would work too.
If you want to do that, here is a site that shows how to do that: Bootstrap-Modal on page-load

Sponsor our Newsletter | Privacy Policy | Terms of Service