javascript-tutorial / javascript-tutorial/en.javascript.info

insertAdjacentHTML() doesn't work in FF

Open
#3,534 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
25.5k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

This part of the code in Popups and window methods doesn't work in Firefox:

newWindow.onload = function() {
  let html = `<div style="font-size:30px">Welcome!</div>`;
  newWindow.document.body.insertAdjacentHTML('afterbegin', html);
};

It doesn't insert html to the document.
In Chrome it works for me.

If other can confirm, then what would be a good way to edit the tutorial?
Maybe just add another caution box with a respective hint (saying that it doesn't work in FF?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “Popups and window methods” tutorial section and reproduce the provided insertAdjacentHTML example in Firefox and Chrome. Confirm the browser-specific behavior, then update the tutorial with an accurate explanation or caution and verify the revised example or guidance in both browsers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.