Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I Customise the title bar in a Pop-Up Alert Box

    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

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    Maine, USA
    Posts
    573
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 .
    boxer_1
    CodingForums Moderator
    "How did a fool and his money get together in the first place?"

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    May 2002
    Location
    Maine, USA
    Posts
    573
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 .
    boxer_1
    CodingForums Moderator
    "How did a fool and his money get together in the first place?"

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    You can get a more customized alert using vbscript. It will only work in IE though:

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

  • #7
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts

  • #8
    New Coder
    Join Date
    Aug 2002
    Location
    Pakistan
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •