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
    Regular Coder
    Join Date
    Sep 2006
    Posts
    131
    Thanks
    5
    Thanked 0 Times in 0 Posts

    checking source and giving permission

    is it possible to do this?

    Code:
    if("linkingfrom".equals(www.google.com)){
      output+= "alert('Granted Access');";   }
    else{
      output+= "alert('You do not have permission to enter this page.');
    }
    what do i put in for linking from??

    Thanks Tony
    ---------
    Client / Server Side Programmer II

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    if(/www.google.com/.test(document.referrer))...

  • #3
    Regular Coder
    Join Date
    Sep 2006
    Posts
    131
    Thanks
    5
    Thanked 0 Times in 0 Posts
    i'm using the code:

    Code:
            if(/www.google.com/.test(document.referrer)){
                output+= "alert('Granted Access');";   }
            else{
                output+= "alert('You do not have permission to enter this page.');";
            }
    and getting these errors...
    Code:
    >javac aiaccess_dev.java
    aiaccess_dev.java:1065: illegal start of expression
            if(/www.google.com/.test(document.referrer)){
               ^
    aiaccess_dev.java:1072: ')' expected
            String folder_code = null;
                                     ^
    2 errors
    what to do ??
    ---------
    Client / Server Side Programmer II

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    Sorry- I forgot to escape the periods
    if(/www\.google\.com/.test(document.referrer))

    But you don't get an error with either expression in javascript-
    If you are doing this in java you are posting in the wrong forum...
    javascript really isn't java...


  •  

    Posting Permissions

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