| Computing desk | ||
|---|---|---|
| < October 20 | << Sep | October | Nov >> | October 22 > |
| Welcome to the Wikipedia Computing Reference Desk Archives |
|---|
| The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I've blacklisted certain ad sites in my Windows 7 hosts file, by redirecting those sites to 127.0.0.1, but they still pop up a blank tab or window that says "Site not found", which I then have to close. So, can I instead redirect them to an IP address that just closes the current browser tab ? If it's possible, you would think somebody would have set up such a site. I could, of course, set up my own web server on my PC, but that's more trouble than it seems like such a simple task should require. BTW, here's the JavaScript to close the current tab, and if that server ran this file, I think it would work:
<script>
function closeWindow() {
window.open(,'_parent',);
window.close();
}
</script>
<body onload="closeWindow()">
StuRat (talk) 23:49, 21 October 2017 (UTC)