Skip to content

Commit

Permalink
Do not call window.onload function from load event listener
Browse files Browse the repository at this point in the history
This causes the onload function to run twice, which breaks some websites.
Fixes #420
  • Loading branch information
bvschaik committed May 29, 2019
1 parent 2d3f379 commit 9d0970f
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,7 @@ async function CheckIfURLShouldBeBlocked() {

// Cross-browser implementation of element.addEventListener()
function addPassiveWindowOnloadListener() {
const activeOnloadFunction = window.onload;
window.addEventListener("load", function() {
// window.onload = function () {
if (typeof activeOnloadFunction === "function") {
activeOnloadFunction();
}
CheckIfURLShouldBeBlocked();
}, false);
}
Expand Down

0 comments on commit 9d0970f

Please sign in to comment.