Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Weitere Informationen

Event hashchange and document.title

  • 1 Antwort
  • 1 hat dieses Problem
  • 10 Aufrufe
  • Letzte Antwort von 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?

Alle Antworten (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/.