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 3 of 3
  1. #1
    New Coder
    Join Date
    May 2010
    Posts
    79
    Thanks
    15
    Thanked 2 Times in 2 Posts

    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!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,441
    Thanks
    76
    Thanked 4,372 Times in 4,337 Posts
    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.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

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