Skip to content

Instantly share code, notes, and snippets.

@fmcat
Last active September 16, 2019 18:27
Show Gist options
  • Save fmcat/e0d9643829df93df7d5e1689f8d0f422 to your computer and use it in GitHub Desktop.
Save fmcat/e0d9643829df93df7d5e1689f8d0f422 to your computer and use it in GitHub Desktop.
function switchLayouts(){ var featureToggleString = 'ft_override_enable_pdp_below_the_fold_layout';
var url = new URL(window.location);
var params = params = new URLSearchParams(url.search);
var toggleValue = params.get(featureToggleString);
const isToggleOff = !toggleValue || toggleValue === 'OFF';
params.set(featureToggleString, isToggleOff ? 'ON' : 'OFF');
window.location.search = '?' + params.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment