|
|
Hello, thats html that i decided to hook:
<html><head>
window.onblur=function()
{
alert('try to block me!');
}
</head><body></body></html>
I've made 2 scripts, 1st doesnt work at all, so here only 2nd: // ==UserScript==
// @name test2
// @include *
// ==/UserScript==
function newblur() {
event.stopPropagation();
event.preventDefault();
}
window.addEventListener('blur', newblur, true);
HTMLFormElement.prototype._blur = HTMLFormElement.prototype.blur;
HTMLFormElement.prototype.blur = newblur;
This script works partially (hooks something, like alt+tab defocusing, but still being vulnerable by defocusing with mouse click). Whats wrong, how complitely disable blur event? |
![]() ![]() |
unsafeWindow.onblur = null; |
|
|
Thanks Joe, but now the opposite situation
|
![]() ![]() |
im not understanding you. what else do you need? |
|
|
Just to avoid alert window at ANY situation like mouseclicks, alt+tabs, etc(fully disable onblur event): <html><head>
window.onblur=function()
{
alert('try to block me!');
}
</head><body></body></html>
Maybe there is a way to replace source code with greasemonkey?
|
![]() ![]() |
my code above stops that. there must be something else doing it. whats the page? |
|
|
Tested with firefox 3.0.1 & 3.5.8 and greasemonkey 0.8.20100211.5 (when doing alt+tab and then back to the browser - nasty alert still appears). The "test page" is exactly what I had written in previous post, running as file:// |
![]() ![]() |
works fine on my test page. by the way, your page code doesnt even work. i used that exact code and it showed the function as text on my page. |
|
|
Tested also on 3.6, the same :(
<html><head>
<sript>
window.onblur=function()
{
alert('try to block me!');
}
</sript>
</head><body></body></html>
What browser version do you use?</sript> |
![]() ![]() |
Look, I also made new - replacing script.
// ==UserScript==
// @name antiblur
// @include *
// ==/UserScript==
textNodes = document.evaluate(
"/head/*",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
var searchRE = new RegExp('onblur','gi');
var replace = 'fuckblur';
for (var i=0;i<textNodes.snapshotLength;i++) {
var node = textNodes.snapshotItem(i);
node.data = node.data.replace(searchRE, replace);
}
|
![]() ![]() |
Replacing or removing text within script tags achieves nothing in terms of scripting. Additionally, /head/ is wrong because the document starts with html, so you should use /html/head/. |
![]() ![]() |
scriptonator wrote:This should work with the existing logic and is more accurate on usage of document.evaluate... AVG's comment is correct within that contextNode. You might need this too.... var allNodes = document.evaluate( "/head/*", document.documentElement, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null ); ... |
![]() ![]() |
So must I return to unsuccessful disabling "window.onblur event" by hooking it instead of replacing? |
![]() ![]() |
nobody knows? :(
<html><head>
<sript>
window.onblur=function()
{
alert('try to block me!');
}
</sript>
</head><body></body></html>
|
![]() ![]() |
scriptonator wrote: unsafeWindow.onblur = null;this works perfectly fine. u must be doing something wrong |
![]() ![]() |
scriptonator wrote:...and have you set fileIsGreaseable to true in about:config? |
|
|
LouCypher, can I kiss you :D
|





