473,586 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why does firefox beat IE here?

2 New Member
The following is the header of an html page that I want to password protect. In firefox everything works fine, but in IE, it automatically goes to the 'incorrect login' page without even prompting...... please help!!!!


[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:sc hemas-microsoft-com:vml" xmlns:o="urn:sc hemas-microsoft-com:office:offi ce">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Comput er Science Reading Group: Restricted</title>
<SCRIPT language="JavaS cript">
<!--
var username;
var password;
var user1="cs";
var pass1="42";
username=prompt ('Please enter the username for CS Reading Group',' ');
password=prompt ('Please enter the password for CS Reading Group',' ');
if ((username==use r1) && (password==pass 1))
alert('Welcome to the CS Reading Group! Click OK to Enter!');
else { window.location ="incorrect.htm "; } //-->
</SCRIPT>
<style type="text/css">
.style1 {
text-align: center;
font-size: xx-large;
}
.style2 {
border-width: 0px;
}
.style3 {
text-align: left;
}
.style4 {
text-decoration: underline;
}
.style5 {
text-align: center;
font-size: large;
}
.style6 {
font-family: Calibri;
text-align: center;
}
.style7 {
text-align: center;
}
</style>
</head>[/HTML]
Oct 17 '07 #1
4 1258
gits
5,390 Recognized Expert Moderator Expert
hi ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. var username;
  3. var password;
  4.  
  5. var user1="cs";
  6. var pass1="42";
  7.  
  8. username = prompt('Please enter the username for CS Reading Group',' ');
  9. password = prompt('Please enter the password for CS Reading Group',' ');
  10.  
  11. if ((username==user1) && (password==pass1)) {
  12.     alert('Welcome to the CS Reading Group! Click OK to Enter!');
  13. } else {
  14.     window.location="incorrect.htm";
  15. }
  16.  
that should work (which IE-version do you use?) ... but be aware ... everybody can read or change or hack that check on client-side (you may have a look at the source code anytime, and change the page locally) ... you should really do a serverside check ... never, never do this on client-side ...

kind regards
Oct 17 '07 #2
rushilgoel
2 New Member
hi ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. var username;
  3. var password;
  4.  
  5. var user1="cs";
  6. var pass1="42";
  7.  
  8. username = prompt('Please enter the username for CS Reading Group',' ');
  9. password = prompt('Please enter the password for CS Reading Group',' ');
  10.  
  11. if ((username==user1) && (password==pass1)) {
  12.     alert('Welcome to the CS Reading Group! Click OK to Enter!');
  13. } else {
  14.     window.location="incorrect.htm";
  15. }
  16.  
that should work (which IE-version do you use?) ... but be aware ... everybody can read or change or hack that check on client-side (you may have a look at the source code anytime, and change the page locally) ... you should really do a serverside check ... never, never do this on client-side ...

kind regards



I know about the 'insecurity' of javascript for password protection but I was just trying it temporarily.... ..

But the problem still remains.....the code doesn't work with IE 6 or 7......plz help!!!
Oct 17 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
I'm not sure why your code doesn't work in IE6, but in IE7, the developers/designers decided that prompt was dangerous and it no longer works.

It has been badly implemented because if someone does allow the script to run, IE has already blocked it! Then if you refresh the page, it's conveniently forgotten that you've given permission for the script to run. Well done(!)

The solution is to write your own prompt script. If you search for "ie prompt alternative" or similar, you may get a pseudo-solution.
Oct 17 '07 #4
gits
5,390 Recognized Expert Moderator Expert
hmmm ... the following example works with my IE6

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html>
<head>
<script typ="text/javascript">
<!--
function open_win(form) {

}
var username;
var password;

var user1="cs";
var pass1="42";

username = prompt('Please enter the username for CS Reading Group',' ');
password = prompt('Please enter the password for CS Reading Group',' ');

if ((username==use r1) && (password==pass 1)) {
alert('Welcome to the CS Reading Group! Click OK to Enter!');
} else {
window.location ="incorrect.htm ";
}
//-->
</script>
</head>
<body>
test
</body>
</html>
[/HTML]
do you get an error?

kind regards
Oct 17 '07 #5

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

Similar topics

4
2150
by: Schraalhans Keukenmeester | last post by:
I have no clue why below code (found it somewhere and altered it a wee bit to my needs) will run without problem in both IE and Mozilla FireFox 1.0 but in the latter it takes up close to 100% cpu. It does check for type of browser, and indeed all works fine apart from that ridiculous amount of cpu taken. If you want to see if it does so in...
7
5176
by: Todd Cary | last post by:
I inherited an application where the Flyout works in Firefox but not in IE. My JavaScript background is sparse, so I am not sure how to approach the problem. Any suggestions are welcomed! The performance can be viewed at http://209.204.172.137/casesearch/php/all.php Here is the base JavaScript:
87
9549
by: expertware | last post by:
Dear friends, My name is Pamela, I know little about CSS, but I would like to ask a question I have an image on a web page within a css layer: <DIV ID=MyLayer STYLE = "position: absolute;top:68px; left:563px; width:640px;height:480px;"> <IMG src="ReportImageBox_12.54.52.png" width=640 height=480></IMG>
89
6003
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
2
2876
by: Jim Carr | last post by:
Upon entering the site www.FutureByDesign-Music.com with IE6, my clipboard is erased and then disabled in all other Windows XP applications. Navigating to another site returns clipboard functionality, but whatever was on the clipboard before is lost. If I disable running JavaScript on the page, the clipboard is unaffected. Viewing the page...
7
4639
by: Xah Lee | last post by:
Look at this page http://xahlee.org/emacs/wrap-url.html Look at it in Firebox, look at it in Safari, in Opera, and look at it in Microsoft Internet Explorer. The only fucked up case, is Firefox. Namely, that it does not respect the font used when dealing with «width:80ex». The way to test this visually, is by this code: <pre...
7
2323
by: mavigozler | last post by:
IE7 does not appear to set an event on contained text inside SPAN elements whose 'onclick', 'onmouseover', and 'onmouseout' events, defying the HTML recommendation. Firefox appears to conform. Is that so?
5
2681
by: loveshack | last post by:
Can anyone help me please (i am quite a novice, but having fun learning). Im not sure if this is an ASP problem, a javascript problem or a browser problem. Firstly, everything i have written works fine in IE7 and beta IE8. My pages do not work however in Safari or Firefox, and please dont beat me, but i use Frontpage to write my site, and i...
29
3296
by: zalek | last post by:
I am writing application with Ajax in sync mode - xmlHttp.open("GET", url, false). I noticed that in FireFox handler doesn't starts. It starts when I use xmlHttp.open("GET", url,true). I need to use it in sync mode. Any ideas what can I do? Thanks, Zalek.
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6617
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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 we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.