Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139833

Detect a click and compare URLs

$
0
0

I need to detect mouse clicks after page loads and the function is exectued which deletes ads.

After the mouse click is detected, it will compare the URLs and it should do this on every mouse click.

I have tried using Google's stuff, but couldn't figure out, so I switched to plain JS.

    let host = window.location.host; // www.adjaranet.com
    let path = window.location.pathname; // /...
    let href = window.location.href; // http

    // alert(path); // movie section = /Movie/main // homepage = /

    if (href == "https://www.adjaranet.com/") {

      function deletor() {
        // some code that executes...
      }

      deletor();

      // Here I want to detect mouse clicks and then compare the URLs
    }

And if mouse is clicked and the page is changed (url), it should run another separate function.


Viewing all articles
Browse latest Browse all 139833

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>