Søg i Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

html local file opened in firefox does not run javascript function

  • 2 svar
  • 1 har dette problem
  • 2 visninger
  • Seneste svar af cor-el

more options

Hello,

I am creating an html page, which is stored into my computer, and on opening it with Firefox, a javascript function that should run when the page opens, it doesn't. It does in chrome, but in Firefox it doesn't (77.0.1 (64bit)).

The definition of the function is not inline. Other than that, it is a regular function.

Any clues?

I do not have any add ons installed in firefox.

Thank you in advance,

Diego

Hello, I am creating an html page, which is stored into my computer, and on opening it with Firefox, a javascript function that should run when the page opens, it doesn't. It does in chrome, but in Firefox it doesn't (77.0.1 (64bit)). The definition of the function is not inline. Other than that, it is a regular function. Any clues? I do not have any add ons installed in firefox. Thank you in advance, Diego

Alle svar (2)

more options

Is your JavaScript path absolute or relative? It needs to be relative.

Absolute would probably have a / slash at the front. It doesn't work because that sends Firefox looking back to the root directory. On a website that would be the domain name, but on a local HTML file that's the root of your drive.

Relative would be using .. double dots to navigate to the JavaScript file from where the local HTML file is stored.

more options

You can check the Web Console for possible error messages.