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 JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

have same issue with alert()

I'm having the same issue as several others. I have the correct code but only a white box appears on the preview in chrome and firefox.

7 Answers

Ben Buehler
Ben Buehler
5,390 Points

I have been having this issue (both on Chrome and IE, and on three separate computers) as well. Honestly, after a while I just ignored it and moved on. Fortunately, I stumbled upon something that worked for me a few more videos in.

While it seems like closing your preview webpage, then relaunching it from your updated workspace should work, it doesn't for some reason; the preview keeps accessing the old javascript file (this becomes apparent when you're practicing debugging). Surprisingly, what has worked for me is simply keeping the preview webpage open and refreshing it after you make and save changes in the workspace. I'm a newcomer to web programming, but from what I've gleaned refreshing the page forces it to also refresh the cache, which must not be updating correctly from workspace.

Hope this helps you as well! (Though keep in mind that if you've made a programmatic error or have a typo as well, it might not appear anyway.)

Aaron Howell
Aaron Howell
1,001 Points

+1 Refreshing the page after the initial load populated the alert and document.write().

Thanks!

jason chan
jason chan
31,009 Points

Did you clear your browser history? try different browser.

Make sure dns is working. Update your operating system. Restart your machine.

That's about it.

Your document.write has a typo. there is a double quotes before the closing h1 tag. view below.

alert("Hello World!");
document.write("<h1>Hello World!!!</h1>");
Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

On the document.write statement on the second line you have a quote before the last h1 tag:

document.write("<h1>Hello World!!!</h1>");

thanks for that, but I still get a blank page with a white box and no alert.

after copying everything into my editor (webstorm) it does preview correctly on all browsers. Not sure why it won't work from the Treehouse workspace.

try removing the alert from the scripts.js and see if the document.write will work. if so then you might have accidently prevented alerts from displaying on your treehouse preview page.

Francis N
Francis N
10,376 Points

alert("Hello from Treehouse"); document.write("<h1>Welcome to JavaScript Basics</h1>"); alert("Thanks for visiting");

i have this in my workspace and no alerts or text inserted in preview.