Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-03-2013, 02:21 AM   PM User | #1
kenshn111
New Coder

 
Join Date: May 2010
Posts: 75
Thanks: 13
Thanked 2 Times in 2 Posts
kenshn111 is an unknown quantity at this point
How to check if domain is in the 'allowed list'?

I'm sorry if I'm not clear enough, but I believe I've seen sites which uses JavaScript where it checks if the domain is in the 'allowed list' so that it sents out information to that site? Am I in the right forum or does it use .htaccess? D:

Sorry!
kenshn111 is offline   Reply With Quote
Old 02-03-2013, 04:26 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Even if JavaScript could do that, it would be useless if a violator simply turned off JavaScript in his/her browser.

And, really, any domain that is hacking your site and/or doing a Denial Of Service attack is not going to be using a browser, anyway.

No, you don't want to even think about JS for this.
__________________
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.
Old Pedant is offline   Reply With Quote
Old 02-03-2013, 05:39 PM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
sounds like you're talking about CORS. you can list domains that ajax is allowed to fetch using the "Access-Control-Allow-Origin" header.

there's also the document.domain property which tells you your current domain. If you had a list of domains, you would use document.domain to spot that domain in a lineup.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:57 AM.


Advertisement
Log in to turn off these ads.