Forum Moderators: open

Message Too Old, No Replies

IE7 has disabled javascript prompts - What should I do?

         

Kathy_OC

7:20 pm on Feb 2, 2007 (gmt 0)

10+ Year Member



I wrote a web application a few years ago that uses the javascript prompt. Now that IE7 has disabled the javascript prompt, my app no longer works if a user has IE7.

What is a good alternative for a javascript prompt? What other work-arounds are available?

Thanks,
Kathy

birdbrain

9:21 pm on Feb 2, 2007 (gmt 0)



Hi there Kathy_OC,

and a warm welcome to these forums. ;)

I have no problem with prompt(); in IE7. :)

birdbrain

Kathy_OC

1:01 pm on Feb 5, 2007 (gmt 0)

10+ Year Member



Thanks for your response and welcome.
From what I'm reading, IE7 defaults to disabling the javascript prompt. Take a look at this post [webmasterworld.com...]

The user can change the default, but I can't expect the public to be savvy enough to know how to do that. So I'm looking for an alternative to prompt(). Any suggestions?

Kathy

rocknbil

8:25 pm on Feb 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, my First Rule of Javascript (and accessibility) is to build your applications/pages so they function WITHOUT requiring Javascript. So my recommendation would be to create an alternative non-javascript method to collect whatever you collect in the prompt if Javascript is disabled or simply fails to function. Even if you manage to fix this, this remains to be an issue, Javascript dependence is a Bad Idea.

Barring that, you can do one of two things:

userid=prompt('enter your user id');

if (! userid) {

my_form = '<form method="post" action="some_action">';
my_form +='<input type="text" name="userid">';
my_form += '<\/form>';
document.write(my_form);

}

Or you can use the document write to create a link that points to a small page to tell your users how to enable Javascript prompts.

A word here - don't bother doing a browser ID to produce code only for IE 7. It's convoluted and unnecessary, and will break when the next version comes out, and will also cause users with the prompt enabled in IE7 to get the same output. Your problem is the prompt - it doesn't matter what browser or version it is, if the prompt is not returning the required value, that's all you need to act on.

But as I said, all this falls down if Javascript is disabled.

Kathy_OC

3:42 pm on Feb 6, 2007 (gmt 0)

10+ Year Member



Thanks, that helps confirm the conclusion I was reaching. I particularly appreciate your tip about not checking for the IE7 browser. I had seen that suggestion on another website and it didn't seem like a good idea.

Kathy