Skip to content

Instantly share code, notes, and snippets.

@acoyfellow
Created December 2, 2021 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acoyfellow/bcf8b74c9075ccff77d959ff961bea12 to your computer and use it in GitHub Desktop.
Save acoyfellow/bcf8b74c9075ccff77d959ff961bea12 to your computer and use it in GitHub Desktop.
Cookies Popup Example
<script src="https://unpkg.com/optkit@latest/index.js"></script>
<script>
const acceptedCookies = localStorage.getItem('acceptedCookies');
if(!acceptedCookies){
let optKit = new OptKit({target:document.body})
const testConfirm = async (_) => {
let confirmed = await confirm("Do you accept cookies?");
if (!confirmed) return window.location="https://google.com";
localStorage.setItem('acceptedCookies', true);
};
testConfirm();
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment