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 trialHenk Jan Borghuis
11,986 Pointsdocument.write seems to be deprecated by Chrome.
Upon execution, the console shows the following message: Uncaught TypeError: Failed to execute 'write' on 'Document': This document requires 'TrustedHTML' assignment.
2 Answers
Rohald van Merode
Treehouse StaffHi Henk Jan Borghuis 👋
This issue often occurs when working in a new blank tab.document.write()
is designed to work within the context of a fully loaded HTML document. When you're working in a new tab, there is no document context, which can lead to this error. You can try visiting any page, or run that line of code in this very tab and the content of the page should be overwritten as expected.
Hope this helps! 🙂
Henk Jan Borghuis
11,986 PointsHi Rohald van Merode ,
Thanks for pointing that out to me. I was indeed working with a new tab. Tested it with the workspace index file and now it does work for me as well!