Skip to content

most basic adblock detection api #44

Description

@K2SO4AL2SO4324H2O
const adsEnabled = async () => {
 let ads = true;
    try {
      const url = `https://ads.google.com?=${new Date().getTime()}`;
      await fetch(url, { mode: "no-cors" });
    } catch (error) {
      if (error.message === "Failed to fetch") {
        ads = false;
      }
    }
return ads;
  };

// check 

const isAdEnabled = await adsEnabled();
console.log(isAdEnabled);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions