-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block the focus, focusin, visibilitychange, and blur events #135
Comments
window.onblur = null;
window.blurred = false;
document.hasFocus = function () {return true;};
window.onFocus = function () {return true;};
Object.defineProperty(document, "hidden", { value : false});
Object.defineProperty(document, "mozHidden", { value : false});
Object.defineProperty(document, "msHidden", { value : false});
Object.defineProperty(document, "webkitHidden", { value : false});
Object.defineProperty(document, 'visibilityState', { get: function () { return "visible"; } });
document.onvisibilitychange = undefined;
for (event_name of ["visibilitychange",
"webkitvisibilitychange",
"blur", // may cause issues on some websites
"mozvisibilitychange",
"msvisibilitychange"]) {
window.addEventListener(event_name, function(event) {
event.stopImmediatePropagation();
}, true);
} |
Hello, Do I understand correctly that these are proposed wrappers? |
Yes. The code in the comment is my description if you will. It's not designed for a extension, it's close to untested (ran on holdd.netlify.app and it disabled the relevant bit), there may be a better way, etc, But a picture is worth a thousand words and this effectively describe what I am going for I don't have much data on how it could be exploited, but the obvious thing that comes to mind is analytics, and targeted content based on attention span, and I can't figure out how the browser api would be useful to a website |
I explicitely mentioned this issue in https://pagure.io/JShelter/webextension/issue/66. We do not modify/filter events, yet. But I think that we should explore the possibilities. |
Thank you for taking care to crosslink, it means lots to me |
some websites might also use mouse in mouse out events as a workaround |
No description provided.
The text was updated successfully, but these errors were encountered: