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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    blocks opening external links

    Friends. I require a script which blocks opening external site when someone click on any external link on my website.

    Is it possible??

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    29,353
    Thanks
    83
    Thanked 4,904 Times in 4,865 Posts
    Ummm...if you don't want them clicking an external link, don't put one on your site.

    Presto, you are done.
    Be yourself. No one else is as qualified.

  • Users who have thanked Old Pedant for this post:

    Arcticwarrio (06-19-2012)

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,508
    Thanks
    205
    Thanked 2,581 Times in 2,559 Posts
    Is he trying to block links contained in adverts and thus violate his TOS?

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,962
    Thanks
    0
    Thanked 688 Times in 677 Posts
    You can't prevent anything with JavaScript unless it is your browser - then you an attach JavaScript to the browser that blocks sites from being able to interfere with what you want to do. JavaScript attached to web pages can be turned off or overridden.

    The only part of the web page under the control of the page author is the HTML and what runs on the server.
    Last edited by felgall; 06-19-2012 at 09:36 AM.
    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.


  •  

    Tags for this Thread

    Posting Permissions

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