...

View Full Version : How do I Customise the title bar in a Pop-Up Alert Box



SLiM6y
08-01-2002, 12:27 AM
I have a password script that I use:

<HEAD>
<SCRIPT language="JavaScript">
<!--hide
var password;

var pass1="xxxxx";
var pass2="xxxxx";

password=prompt('Please enter your password to view this page!','');

if (password==pass1 || password==pass2)
alert('Password Correct! Click OK to enter!');
else
{
window.location="http://www.liquid2k.com/mexican-cafe/wrong.html";
}
//-->
</SCRIPT>

Where the xxxx is obviously the passwords. Feel free to use this script by the way, it works quite well....

But.... How do I customise the alert box title that pops up when you go to the page. It says at the moment "Explorer User Prompt" (you can check it out at
http://liquid2k.com/mexican-cafe/members.htm ) In fact even this posting page has the same problem... Can you customise that title bar to read something else.. Like Welcome to the Mexican Cafe.... Anything?

Thanks in advance. I hope that the passwprdscript is of help to you too!

SLiM

boxer_1
08-01-2002, 12:36 AM
I believe the alert box settings are 'hard-coded' into the browser and thus, cannot be customized. However you can cause line breaks in your alert message by adding "\n" where you want the lin break. For example:

alert('Password Correct!\nClick OK to enter!');

Perhaps there is a way to further customise the alert box, but if there is, I don't know about it ;).

SLiM6y
08-01-2002, 12:54 AM
Ok then.. Perhaps it is in hard coding... But... Can you customise the alert box with perhaps a VB Script. I can customise them in Excel using VBs, so why not in Java?

Any other help?

Thanx

SLiM

boxer_1
08-01-2002, 01:05 AM
I appreciate the thank you PM, but please do not ask me questions via PM. That is what the forum is for. Good luck to you ;).

Roy Sinclair
08-01-2002, 04:27 AM
The title bar for a prompt box cannot be customized for security reasons, the title is fixed that way so you cannot emulate a prompt from the OS or some other program and fool the end-user into entering information that you have no business asking.

By not allowing you to control the title of that box, it remains clear that the prompt box was generated from a web page regardless of what the box may try to say about itself internally.

Many of the "things you cannot do in javascript" (or vbscript either when using IE) boil down to a security issue.

JohnKrutsch
08-01-2002, 04:52 PM
You can get a more customized alert using vbscript. It will only work in IE though:

http://javascriptkit.com/javatutors/vbalert.shtml

Mr J
08-16-2002, 10:09 PM
Take a look at:

www.huntingground.freeserve.co.uk/style/alert.htm

mhere
08-17-2002, 02:27 PM
handling password issues using client-side scripting can never be secure as everyone can check the source to see your password...
you can use ASP for that..

brothercake
08-17-2002, 02:51 PM
You can do secure password protection client side. What you do is a make a folder in your directory called "password" and then in that folder you make an image called something like "28346.gif" (28346 is the password) - also have a blank index.html in that directory, so noone can see inside it

Then you use an image as your security anchor - send the password to the image src and use onload or onerror to validate the password



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum