Scriptlets
Scriptlets copied to clipboard
Improve `set-cookie-reload` — prevent infinite reload for non-set cookie
At the moment, if for some reason cookie wasn't set (for example, it may happens if website is in iframe and third-party cookies are blocked by browser), then website will be constantly reloading.
Steps to reproduce
- Enable
Block third-party cookiesoption in Chrome - Add these rules:
example.com#%#//scriptlet('set-cookie-reload', 'test', '1')
example.org#%#AG_onLoad(function() { let frame = document.createElement('iframe'); frame.src = 'https://example.com/'; document.body.appendChild(frame); });
- Go to - https://example.org/
Second rule creates iframe with example.com, but it constantly reloading, because cookie was blocked by web browser, so maybe there should be additional check/condition if document.cookie is not empty and if it's not empty then website should be reloaded.