Note that there are some explanatory texts on larger screens.

plurals
  1. POChecking if user has a certain extension installed
    primarykey
    data
    text
    <p>I just found out that the Screen Capture by Google extension makes my website's window.onresize event not fire. </p> <p>I want to perform a javascript check to see if the user has ScreenCapture installed and if so, warn the user of the problem.</p> <p>A year ago I think I heard of some javascript code that could do this, maybe using some google API, but I don't remember.</p> <p>Any insight on this? I haven't developed any extensions so I don't really know how they work.</p> <p>[EDIT] So I have been asked to show some code. As seen in my previous question ( <a href="https://stackoverflow.com/questions/8041730/window-onresize-not-firing-in-chrome-but-firing-in-chrome-incognito">window.onresize not firing in Chrome but firing in Chrome Incognito</a> ), the problem occurs on any window.onresize event function, so I don't think my code really matters.</p> <p>Also, there is quite a lot of my code, I don't know how much of it to paste or if it would be helpful.</p> <pre><code> var debounce = function (func, threshold, execAsap) { var timeout; return function debounced () {//alert("1.1 Y U NO WORK?"); var obj = this, args = arguments; function delayed () { if (!execAsap) func.apply(obj, args); timeout = null; } if (timeout) clearTimeout(timeout); else if (execAsap) func.apply(obj, args); timeout = setTimeout(delayed, threshold || 100); }; }; window.onresize = debounce(function (e) { //alert("1.2 Y U NO WORK?"); flag = true; var point = window.center({width:1,height:1}); doCenter(point); // does something here, but only once after mouse cursor stops }, 100, false); </code></pre> <p>I would like to stress that the problem is not due to the debounce. <code>window.onresize = t; function t (e) { alert("wtf?");}</code> won't work either.</p> <h2>[EDIT2]</h2> <p>Here's the result:</p> <pre><code> var screenCapture = null; var screenCaptureImg = document.createElement("img"); screenCaptureImg.setAttribute("src", "chrome-extension://cpngackimfmofbokmjmljamhdncknpmg/images/arrow.png"); /* * Add event listeners for both "load"- and "error"-event * Set the variable showing the existence of the extension by * setting it to "true" or "false" according to the fired event */ screenCaptureImg.addEventListener("load", doLoad, false); function doLoad(e){ screenCapture = true; //removeImgTag(e); alert("I've so cleverly detected that your Chrome has the ScreenCapture extension enabled. \n\nThis extension interferes with my website's DOM and long story short, it won't be able to scale properly.\n\nSo please disable it. \nConsider this extension: \"Disable All Extensions Plus\", it's a handy selective disabler."); } screenCaptureImg.addEventListener("error", function(e){ screenCapture = false; //removeImgTag(e); }, false); /* function removeImgTag(e) { e.currentTarget.parentNode.removeChild(e.currentTarget); } */ </code></pre> <p>Note that I couldn't get <code>removeImgTag</code> to work, because (at least in chrome), I don't seem to have access to the <code>document</code> object in order to create or remove elements from my page, from within these event functions. This is also why I'm displaying an <code>alert</code> instead of elegantly writing up a <code>document.getElementById("something").innerHTML=</code>...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload