in-line JS setTimeOut does not work in firefox

I’m having a problem with a piece of in-line JavaScript in Firefox. It’s s simple SetTimeout() method within an <a> element that sets a delay (to allow time for an animation to play out) before opening the destination link in question.

The Problem:
When I click on the link in Firefox I get taken to a white page with the number 2 in the top left hand corner of the screen.

Other Browsers:
Opera, Chrome, Edge, AVG Secure Browser – all work as expected and open the destination link as expected.

The Code:
I’ve stripped down the code to the bare minimum in order to isolate the problem and realise that it is the in-line JS within the link that Firefox does not like (or is completely ignoring!) Whatever it is, I get no warnings or exceptions thrown when looking in FF developer tools.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <p id="homepage">
          href="javascript:setTimeout(()=>{window.location = './index.html'},500);"

At first we thought this could be an IDE problem or server related issue but those possibilities have been eliminated.

Has anyone seen this problem before or know why I’m encountering this purely in Firefox?

Any help would be greatly appreciated, so, thanks in advance for any assistance you can provide.

Kind regards,

Leave a Comment