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

A lot of people disable pop-ups, and I presume this disables prompts as well. What are some ways to over-ride this?

I suppose some sort of iFrame manipulation or another in-browser class could be written that is not specifically a "prompt" or "alert" but that would have to be custom built.

Are there any other methods?

1 Answer

I would expect most people will see javascript prompts. Even with several types of adblock software, typically these types of prompts will display, with the option to prevent additional prompts from displaying.

As long as you're using them responsibly, I would think most people will see them as intended.

That may be true in the default settings of modern browsers, especially Chrome, however, that is not true across the board and I expect that there are necessary work-arounds for this problem. One of the plug-ins of my browser automatically disables all pop-ups by default. It is very robust and not a single pop-up gets through without my permission.

On stackoverflow.com, the use of alerts and prompts were regarded as "bad programming practice" for this reason. What do you think of that?

I'm definitely not an expert, but so far I haven't run into a scenario where I really wanted to use a prompt or alert. You're right, I think there are just better options. I mean, we all disable pop-ups for a reason, right?

I'd be curious to know what the work arounds are, if someone on here knows. I would imagine the more agressive blockers may not be letting any scripts run at all.

That's what browsers like Tor and noscript are all about, yes. But I should take away the prompt issue, my issue only seems to regard alert more than prompt.