I'm looking to block an alert on a website via a userscript loaded in via Tampermonkey (or a similar extension/plugin).
The code for said alert is triggered on if(window.parent==window){alert()}
and is contained in a .js file that the HTML page loads in via <script>
, so that complicates matters further.
I've tried a simple window.alert = function() { /* NOTHING */ };
as well as if(window.parent==window){};
but to no avail. (I'd read that you 'replace' the original code by adding another statement, but I'm guessing that doesn't apply to userscripts in relation to the webpages they're loaded into.)
I'm guessing that a more practical solution would be to fake a parent window as not to trigger the alert, but I couldn't manage to get that to work either.
How would I go about doing this, if this is possible at all?