Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Glynis DeMone
Glynis DeMone
1,023 Points

VM390:1 Uncaught TypeError: Failed to execute 'write' on 'Document': This document requires 'TrustedHTML' assignment.

I am getting this error when I try to run document.write in chrome. I do not get the error if I use safari on a Mac, but it also doesn't seem to be doing anything.

2 Answers

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Treehouse Project Reviewer

This sounds like an issue regarding a newer security feature named Trusted Types. It's possible Chrome handles them differently from other browsers. Are you seeing this document.write used in a video here on Treehouse? If so, please drop the link so I can take a look 👍

I would try to avoid this method and manipulate the DOM with methods / properties such as textContent, innerHTML & insertAdjacentHTML etc..

i am. getting the same error code when i try to run the code from the video i am brand new to Javascript and clueless what i need to do?

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Treehouse Project Reviewer

Adam Martin , can you please post a link to the video this is shown in? I'm still not sure as this post was placed in the general JavaScript topic and not from beneath the video.