Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

html local file opened in firefox does not run javascript function

  • 2 ответа
  • 1 имеет эту проблему
  • 2 просмотра
  • Последний ответ от 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

Все ответы (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.