Certainly! Here's an example of a JavaScript code snippet that redirects all hyperlinks on a webpage to a specific website URL:
html
Copy code
Hyperlink Redirect
Example hyperlink: Visit Example
In this code, JavaScript is used to add an event listener to all tags (hyperlinks) on the webpage. When a hyperlink is clicked, the event listener prevents the default action (i.e., navigating to the original URL) using event.preventDefault(). Instead, it redirects the page to the specified website URL by setting window.location.href to 'http://www.new-website-url.com'. You can include this JavaScript code within your HTML file or link it externally by using the
Post a Comment