A JS command to open the cookie banner on the 2nd screen straightaway
planned
Jānis Elmeris
We would like to programmatically (by JavaScript) open the cookie banner in some cases, but we would like to open the second screen with all the options straight away, skipping the first screen which is configured very minimalistic in our case. Those cases when we use JS to open the banner are different exactly in the need to get to the specific options quickly, so the simple initial screen is only a hindrance.
By "second screen" I mean the "cookie declaration" / "show details" screen. We have option "Open cookie declaration in a new popup" enabled.
D
Dominic Morgan
I too would like this functionality.
In the meantime, I have found the following code is effective to programatically open the cookie preferences overlay. I use it on a button click so you may need to adapt it if you want it to show very early on a page load.
if (window.CookieScript) {
var observer = new MutationObserver(function(mutations) {
if (document.getElementById("cookiescript_manage")) {
document.getElementById("cookiescript_manage").click();
observer.disconnect();
}
});
observer.observe(document, {childList: true, subtree: true});
window.CookieScript.instance.show();
}
Apologies for the slightly ropey formatting this system adds.
M
Maria Söderberg
Yes, this would be awesome!
T
Thomas
planned