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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Works in Chrome and FF, not IE or Safari (Noob:)

    Hey Everyone,

    I have a simple Java Script function I setup for a pop up that requests a discount code. Works awesome in Chrome, FF and on smart phones... but IE and Safari don't work at all.

    Here is the code..

    This is in my header

    <script>
    function passWord1018() {
    var testV = 1;
    var pass1 = prompt('Please Enter The Discount Code',' ');
    while (testV < 3) {
    if (!pass1)
    history.go(-1);
    if (pass1.toLowerCase() == "ultra") {
    alert('Code Accepted! Press Ok To Be Redirected To The Discounted Price Page');
    window.open('discounted101018.aspx');
    break;
    }
    if (pass1.toLowerCase() == "sexydiscount") {
    alert('Code Accepted! Press Ok To Be Redirected To The Discounted Price Page');
    window.open('discounted201018.aspx');
    break;
    }
    testV+=1;
    var pass1 =
    prompt('Code Denied - Code Incorrect, Please Try Again.','Code');
    }
    if (pass1.toLowerCase()!="password" & testV ==3)
    history.go(-1);
    return " ";
    }
    </script>

    This is in the body

    <center>
    <form>
    <br />
    <input type="button" value="Enter Discount Code" onclick="passWord1018()" />
    </form>
    </center>

    I found on another site where someone mentioned the <center> tags are not used anymore, but i tried removing those and still nothing...

    Any insight would be helpful...Thanks

    Jason

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Which Doctype have you used? Or: have you used any Doctype in the top of your document?

    On the other side it is a good habit to use always the braces whenever you are dealing with conditionals, loops, etc:
    Code:
    if(condition){
    //statements, expressions, etc...
    }
    At least to help the others to follow your codes, if not for other reason.
    Last edited by Kor; 03-25-2011 at 09:34 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,613
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    Are you aware that this code is essentially useless if you have a customer who is even a tiny bit computer savvy? All they have to do is a VIEW==>>SOURCE of your page to see the passwords.

    If it's really just a marketing ploy and you want everybody to get discounts, then of course it's okay. But if you really intend for the passwords to be even moderately safe, you should be doing all the password checking on the server, in your ASP.NET code.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Its a DNN site so all the pages are aspx. I did not setup a doctype for the header.

    No code security is not a big issue, discounts are only 10% and 20% so if clients think they are getting away with something that is fine. Just means more sales... Plus since its a DNN site there is like 800+ lines of code just to find the correct discount "code" so if they find it, they deserve the 10% discount anyway
    Last edited by jcoment; 03-25-2011 at 10:20 PM.


  •  

    Posting Permissions

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