Scriptlets icon indicating copy to clipboard operation
Scriptlets copied to clipboard

Improve `set-cookie-reload` — prevent infinite reload for non-set cookie

Open AdamWr opened this issue 3 years ago • 0 comments

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

  1. Enable Block third-party cookies option in Chrome
  2. 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); });
  1. 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.

AdamWr avatar May 05 '22 12:05 AdamWr