Showing questions tagged: Show all questions

Javascript Redirection Not Working

Hello, I have a web page that prints a document, and then redirects back to the main page. This website has always worked in every browser, and now in Firefox 84.0.2 it n… (read more)

Hello,

I have a web page that prints a document, and then redirects back to the main page. This website has always worked in every browser, and now in Firefox 84.0.2 it no longer redirects.

What changed in Firefox, and how do I get it redirecting again?

Here is a snippet of the code in question:

<script type='text/javascript'>

    var interval = setInterval(function() {
         if(document.readyState === 'complete') {
              clearInterval(interval);
              window.print();
         }
    }, 100);
    
    window.onbeforeprint = function() {
         window.location = 'https://www.mozilla.org';
    }

</script>

Asked by Fred 2 weeks ago

Last reply by Fred 4 days ago