您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Detects and stops nefarious URL redirections allows redirects on trusted websites and logs the actions
当前为
Nefarious URL Redirect Blocker is a Tampermonkey script that detects and stops URL redirections, ensuring that you stay on the original URL and avoid being redirected to unintended websites. It provides a seamless browsing experience by preventing unwanted redirects and keeping you on the webpage you initially visited.
The Nefarious URL Redirect Blocker script utilizes JavaScript to monitor URL changes and intercept redirection attempts. Here's a breakdown of how the script functions:
The script starts by storing the original URL of the webpage you are currently on.
It sets up event listeners for the beforeunload
and popstate
events, which are triggered when a page is about to be unloaded or when the browser history changes (e.g., when navigating forward or backward).
The script continuously checks for URL changes by comparing the current URL with the stored original URL.
If a URL change is detected and the script has not already been activated, it means a redirection attempt has been made.
The script then takes the following actions:
window.history.pushState()
, creating a new history entry.window.history.replaceState()
.The script resets its activation flag and schedules the next check for URL changes after a short delay (100 milliseconds).
This process continues, enabling the script to continuously monitor and prevent redirections throughout your browsing session.
To use the Nefarious URL Redirect Blocker script, follow these steps:
Install the Tampermonkey browser extension in your preferred web browser (e.g., Chrome, Firefox).
Open the Tampermonkey dashboard and click on the "+" button to create a new script.
Copy and paste the entire code of the Stop Redirects script into the Tampermonkey editor.
Customize the @match
directives in the script header to specify the websites or URL patterns where you want the script to be active. By default, it matches all HTTP and HTTPS URLs.
Save the script in Tampermonkey.
The script will now be active and will automatically detect and stop redirects on the specified websites.
To view the script's actions and logs, open the browser console (usually by pressing F12 or right-clicking and selecting "Inspect" > "Console").
That's it! With the Nefarious URL Redirect Blocker script installed and active, you can browse the web without worrying about unwanted redirects. The script will silently work in the background, ensuring that you stay on the original URLs you visit.