Questo sito potrebbe offrire funzionalità limitate durante le operazioni di manutenzione per migliorare l'esperienza utente. Se un articolo non risolve il tuo problema e vuoi richiedere supporto, la nostra comunità di supporto è pronta ad aiutarti tramite @FirefoxSupport su Twitter e /r/firefox su Reddit.

Cerca nel supporto

Attenzione alle mail truffa. Mozilla non chiederà mai di chiamare o mandare messaggi a un numero di telefono o di inviare dati personali. Segnalare qualsiasi attività sospetta utilizzando l'opzione “Segnala abuso”.

Ulteriori informazioni

Questa discussione è archiviata. Inserire una nuova richiesta se occorre aiuto.

Event hashchange and document.title

  • 1 risposta
  • 1 ha questo problema
  • 10 visualizzazioni
  • Ultima risposta di Paul

more options

I have a problem with some JavaScript code that is run on a hashchange event.

The code updates the web document, and also the document.title. The document.title is modified last.

If not modifying document.title, everything works fine. If updating document.title, the code sometimes fails, but not always. The symptoms are as follows.

  • The document.title is updated correctly, according to the A-tag with the hash URL that was clicked.
  • The URL field in the browser is not updated to the new value.
  • Non of the other document updates are done, even if they are performed on the code lines before changing document.title.

If a move the mouse outside Firefox and click in another window, the browser URL field is updated and the rest of the document is updated.

I then tried the code in google-chrome. There everything works fine.

If I add a console.log() in the hashchange eventhandler, everything works fine. Another work-around is to use window.setTimeout and delay modification of document.title by e.g. 10ms.

Is this a problem in Firefox, or am I not supposed to modify document.title on the hashchange event?

I am using Firefox 88.01 for Fedora 33.

I guess I should not include HTML and JavaScript in this editor?

I have a problem with some JavaScript code that is run on a hashchange event. The code updates the web document, and also the document.title. The document.title is modified last. If not modifying document.title, everything works fine. If updating document.title, the code sometimes fails, but not always. The symptoms are as follows. * The document.title is updated correctly, according to the A-tag with the hash URL that was clicked. * The URL field in the browser '''is not''' updated to the new value. * Non of the other document updates are done, even if they are performed on the code lines before changing document.title. If a move the mouse outside Firefox and click in another window, the browser URL field is updated and the rest of the document is updated. I then tried the code in google-chrome. There everything works fine. If I add a console.log() in the hashchange eventhandler, everything works fine. Another work-around is to use window.setTimeout and delay modification of document.title by e.g. 10ms. Is this a problem in Firefox, or am I not supposed to modify document.title on the hashchange event? I am using Firefox 88.01 for Fedora 33. I guess I should not include HTML and JavaScript in this editor?

Tutte le risposte (1)

more options

Hi

This does not sound like a Firefox issue, more of a web development question. I recommend that you ask the experts in this at: https://stackoverflow.com/.