Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    8,642
    Thanks
    4
    Thanked 851 Times in 840 Posts

    Take back control of where links open

    The following if added to your browser as a userscript will prevent web sites from being able to open a new window.

    Code:
    window.open = function(x) {location.href = x;}
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  2. #2
    New Coder
    Join Date
    Oct 2008
    Posts
    72
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Do i only have to add

    <script>
    window.open = function(x) {location.href = x;}
    </script>
    If is this it doesn't work...

  3. #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    8,642
    Thanks
    4
    Thanked 851 Times in 840 Posts
    Quote Originally Posted by tribalmp View Post
    If is this it doesn't work...
    No - you add it to your browser - not to a web page - so no script tags are required.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •