473,503 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript: window.open & IE 7

3 New Member
This script works fine in all browsers/platforms except Internet Explorer 7 for Windows. What can be done to make it work there too? Currently, when the form button is clicked, IE 7 returns to the previous page.

<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('Please enter your password.','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "have to hide the password for now") {
alert('Password correct!');
window.open('realtor_section/access.htm');
break;
}
testV+=1;
var pass1 =
prompt('Access denied - password incorrect; please try again.','Password');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
</head>

<body>
<CENTER>
<FORM>
<img src="images_commercial/jd_logo.jpg" width="140" height="210"><br>
<br>
<input type="button" value=" Enter Realtor Section " onClick="password()">
</FORM>
</CENTER>
Jun 19 '07 #1
5 7598
Atli
5,058 Recognized Expert Expert
This is probbly caused by IE7's increeced security.

When a prompt window is open, IE7 usually displays a bar at the top of the window (the thing that crawls down from the address bar) asking the user if he will allow the window.
The problem is that IE denies the prompt, so not to stop the page from displaying, and lets the script continue to run. So it moves on, making the return value from the prompt false, which triggers the history(-1) method.

I reccomend just removing the history(-1) method, then it should work.
Jun 20 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
This script works fine in all browsers/platforms except Internet Explorer 7 for Windows. What can be done to make it work there too? Currently, when the form button is clicked, IE 7 returns to the previous page.

<SCRIPT LANGUAGE="JavaScript">
function password() {
var testV = 1;
var pass1 = prompt('Please enter your password.','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "have to hide the password for now") {
alert('Password correct!');
window.open('realtor_section/access.htm');
break;
}
testV+=1;
var pass1 =
prompt('Access denied - password incorrect; please try again.','Password');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
</head>

<body>
<CENTER>
<FORM>
<img src="images_commercial/jd_logo.jpg" width="140" height="210"><br>
<br>
<input type="button" value=" Enter Realtor Section " onClick="password()">
</FORM>
</CENTER>
I hope you're not using this in a real-life application. Logins/passwords should be strictly server-side. If you want to avoid unloading and going to another page during login, use Ajax for this (which still involves server-side authentication).

With regards to your problem, IE7 is a pain. That's not supposed to happen. It's a simple prompt. I bet it works fine in IE6.
Jun 20 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
This is probbly caused by IE7's increeced security.
Increased security? It breaks millions of web pages that used to work before!
The problem is that IE denies the prompt, so not to stop the page from displaying, and lets the script continue to run. So it moves on, making the return value from the prompt false
That's another problem. It decides in its wisdom to return false. See Working around IE7's prompt bug, er...feature.
Jun 20 '07 #4
rawbear
3 New Member
I hope you're not using this in a real-life application. Logins/passwords should be strictly server-side. If you want to avoid unloading and going to another page during login, use Ajax for this (which still involves server-side authentication).

With regards to your problem, IE7 is a pain. That's not supposed to happen. It's a simple prompt. I bet it works fine in IE6.

Yes, I know that it's not really secure; it's just a temporary solution which worked fine until IE7.
Jun 20 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
Yes, I know that it's not really secure; it's just a temporary solution which worked fine until IE7.
See the link in my previous post which gives a workaround to this bug.
Jun 20 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3392
by: Dariusz | last post by:
I have a problem with a call a Javascript "window.open()" function which is executed as part of a PHP file when a user clicks on an thumbnail image. The PHP is executed which passes some variables...
1
2089
by: GEvans | last post by:
Hi, I have a HTML page consisting of two frames, one visible and one hidden. The hidden frame contains javascript variables holding session information. The visible frame contains interactive...
6
6047
by: Chris | last post by:
Can anyone point me to some code that will display messages, in a seperate window, from javascipt. ie effectively a trace window? TIA Chris
0
6414
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
2
2822
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
4
3493
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
0
1993
by: R L Vandaveer | last post by:
I am having an interesting and rather frustrating issue with the encoding/decoding of parameters with the ASP.NET runtime. What I am doing isn't exactly revolutionary so hopefully someone has an...
3
1646
by: DVir | last post by:
I am having problem with IE. This is the code that I am using, and it works good in every browser except in IE. If somebody can help PLEASE: <script language="Javascript" type="text/javascript">...
1
2551
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript"...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.