Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Strange behavior with JavaScript (The ‘content’ attribute of Window objects is deprecated)

more options

There are several ways to dynamically add text to DOM elements:

1) using innerHTML property (see line 3 of the JSFiddle example below) 2) using createTextNode() method (see commented-out lines 4 and 5)

<script async src="//jsfiddle.net/ahu_lee/9xha1aLc/embed/"></script>

The problem is that when I change my code from one way to another (the order doesn't matter) and then reload the page I get the following error in Firefox: The ‘content’ attribute of Window objects is deprecated. Please use ‘window.top’ instead. (It points to the first line of the code)

And it won't work properly until I restart the application. The other major browsers I have tried didn't have this problem.

So, my question is why does it happen and can it be prevented?

Thank you.

There are several ways to dynamically add text to DOM elements: 1) using innerHTML property (see line 3 of the JSFiddle example below) 2) using createTextNode() method (see commented-out lines 4 and 5) &lt;script async src="//jsfiddle.net/ahu_lee/9xha1aLc/embed/"&gt;&lt;/script&gt; The problem is that when I change my code from one way to another (the order doesn't matter) and then reload the page I get the following error in Firefox: The ‘content’ attribute of Window objects is deprecated. Please use ‘window.top’ instead. (It points to the first line of the code) And it won't work properly until I restart the application. The other major browsers I have tried didn't have this problem. So, my question is why does it happen and can it be prevented? Thank you.

Modified by cor-el

All Replies (5)

more options

direct link to the JSFiddle page: https://jsfiddle.net/ahu_lee/9xha1aLc/

more options
more options

Pkshadow said

Check your code, are these suppose to be like that ? HTML : https://validator.w3.org/ HTML ERRORS : https://validator.w3.org/nu/?doc=http%3A%2F%2Fjsfiddle.net%2Fahu_lee%2F9xha1aLc%2F CSS : https://jigsaw.w3.org/css-validator/ CSS ERRORS https://jigsaw.w3.org/css-validator/validator?uri=jsfiddle.net%2Fahu_lee%2F9xha1aLc&profile=css3svg&usermedium=all&warning=1&vextwarning=&lang=en Please let us know if this solved your issue or if need further assistance.

What does this have to do with my question?

more options

UPDATE

This error no longer occurs. It's very strange. I had tried it several times before asking this question and every time the error occurred but now it's all normal.

more options

Ahu_Lee said

The problem is that when I change my code from one way to another (the order doesn't matter) and then reload the page I get the following error in Firefox: The ‘content’ attribute of Window objects is deprecated. Please use ‘window.top’ instead. (It points to the first line of the code) And it won't work properly until I restart the application. The other major browsers I have tried didn't have this problem.

I'm not sure how you're changing the code... When I edit the script on the Fiddle and click the run button, I don't get that message. When I edit the script on the Fiddle and reload the page, I lose my edits.

Anyway, there might be some other problem, because the deprecated message usually is just advisory and doesn't indicate that the old code is no longer supported.