Windows 10 reached EOS (end of support) on October 14, 2025. If you are on Windows 10, see this article.

Αναζήτηση στην υποστήριξη

Προσοχή στις απάτες! Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου ή να μοιραστείτε προσωπικά δεδομένα. Αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής «Αναφορά παραβίασης».

Μάθετε περισσότερα
Αυτό το νήμα αρχειοθετήθηκε. Κάντε νέα ερώτηση αν χρειάζεστε βοήθεια.
Αρχειοθετήθηκε

html local file opened in firefox does not run javascript function

cor-el απαντήθηκε
godiegotan

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)

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.

You can check the Web Console for possible error messages.