Block any included website besides all other websites
Briefly

The script is intended to block access to any website that includes 'wikipedia.org' by redirecting users to 'https://example.com/', but may have syntax or logic errors affecting functionality.
When developing browser scripts, ensure that your methods for checking URLs, such as includes(), are being correctly applied and that the redirection operates as intended from the document-start phase.
Consider using window.location.replace() instead of window.open() for redirection. This prevents storing the page in the session history, making it a cleaner alternative for blocking access.
Testing your script in a console can help isolate issues. By logging current URLs to the console before redirection, you can gain insight into why the include test may be failing.
Read at SitePoint Forums | Web Development & Design Community
[
|
]