...

View Full Version : checking source and giving permission



ynotlim
12-06-2006, 05:06 PM
is it possible to do this?


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

mrhoo
12-06-2006, 06:05 PM
if(/www.google.com/.test(document.referrer))...

ynotlim
12-06-2006, 09:51 PM
i'm using the 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...

>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 ??

mrhoo
12-07-2006, 06:59 AM
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...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum