JavaScript-How do I prevent cross-domain requests from being masked by plugins such as Adblock?

Source: Internet
Author: User
Tags chrome developer
I have a project like this, you need to set some cookies across domains, and insert some records into the database medium, in order to facilitate the description of the problem, the following definition:

    • Station A: www.a.com

    • Station B: www.b.com

Our situation is that, a station is the domain name of the partner, there may be many, the actual code is still deployed on our server (b station where the server), B station is our server. For ordinary users, it may not be possible to feel the presence of station B in the whole process. In fact, it is similar to divided into alliances, but the whole from user browsing to consumption, the whole process is in a station under the domain name completed.

In order to facilitate the recording of cooperation, in a station a key page, we pass , the cooperation ID and other important parameters to the B station, B Station in the dosomething.php file will set the cooperation required cookie value, record cooperation order information, so that can be in the background of B station to query the relevant statistics.

Now the problem is that when I enable Adblock in my browser, this request from station B is blocked by the http://www.b.com/dosomething.php?partner=6789&params=paramsvalue browser plugin, and I see the request in the network of the chrome Developer tool, which leads to the failed record not being counted, and if the user also has a blocking plugin like that, Will not be recorded.

I wonder if there is any way to solve it?

Reply content:

I have a project like this, you need to set some cookies across domains, and insert some records into the database medium, in order to facilitate the description of the problem, the following definition:

    • Station A: www.a.com

    • Station B: www.b.com

Our situation is that, a station is the domain name of the partner, there may be many, the actual code is still deployed on our server (b station where the server), B station is our server. For ordinary users, it may not be possible to feel the presence of station B in the whole process. In fact, it is similar to divided into alliances, but the whole from user browsing to consumption, the whole process is in a station under the domain name completed.

In order to facilitate the recording of cooperation, in a station a key page, we pass , the cooperation ID and other important parameters to the B station, B Station in the dosomething.php file will set the cooperation required cookie value, record cooperation order information, so that can be in the background of B station to query the relevant statistics.

Now the problem is that when I enable Adblock in my browser, this request from station B is blocked by the http://www.b.com/dosomething.php?partner=6789&params=paramsvalue browser plugin, and I see the request in the network of the chrome Developer tool, which leads to the failed record not being counted, and if the user also has a blocking plugin like that, Will not be recorded.

I wonder if there is any way to solve it?

The ad in your URL is automatically blocked.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.