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
    29,353
    Thanks
    83
    Thanked 4,904 Times in 4,865 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.
    Be yourself. No one else is as qualified.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,579
    Thanks
    11
    Thanked 613 Times in 593 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 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

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