Show a country selection popup and save choice in Cookie

Show popup on page load


  • Save choice in cookie
<img src="uk.png" alt="Continue to our UK site" onclick="setCountryCookie('UK')" />
function setCountryCookie(country) {
  document.cookie = `fppCountry=${country}`

Redirect to the site they selected

window.location.href = '';

pass a value in header to the new site, check for it on the other site and if present add a cookie

"myCountry=UK; myName=Amna; myAge=31"


["fppCountry=UK", " myName=Amna", " myAge=31"]
matchString('myName is Amna', 'myName') // true
matchString('myName is Amna', 'thyName') // false