Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts

    How to force anchors not to open new window?

    In the simple HTML below I use an anchor to refer to another location on the same page. It works fine on my pc and also when sending it by mail to other people. Only when someone with a mail.com email-address receives the mail and uses the anchor a new window opens in stead of referring just to another place in the same window. I tried to keep it in the same window by using codes like onclick="this.target='_self';" and onclick="self.location=this.href;return false" but in mail.com it does not seem to work. Does anyone know other ways to prevent a new window opening?

    This is the code I use:
    <title> How about this? </title>


    <a name="up"></a><br>

    Dit is suggestie 1 van Kicken en de script aan het eind. <br>
    Ook deze werkt niet<br><br>
    <a href="#anchor5" onclick="this.target='_self';">Press for Anchor5</a><br><br>
    <a href="#anchor6" onclick="self.location=this.href;return false">Press for Anchor6</a>

    <a name="#anchor5"></a>Here is Anchor5<br>
    <a href="#up">Back-UP</a><br><br>
    <a name="#anchor6"></a>Here is Anchor6<br>
    <a href="#up">Back-UP</a>


    <script type="text/javascript">
    for (i in document.links){



  • #2
    Regular Coder
    Join Date
    Aug 2002
    Thanked 0 Times in 0 Posts
    you asked the same question some time ago:


    so I suppose that actually there is no solution for the problem
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #3
    New Coder
    Join Date
    Jun 2002
    Thanked 0 Times in 0 Posts

    tried a simpler version

    have you tried doing this without all the javascript? I thought it was supposed to work like this:

    <a href="#here" target=_self>here</a>

    <a name="here">Here</a>

    there's also _blank, _top, and _parent. I don't know if this works for inner page links, but it's definitely supposed to work when linked to a different webpage.

    Actually, I'm willing to bet you tried this before resorting to the javscripting research, but I thought I'd throw this up for you to look at.
    If at first you don't succeed, spend more time online researching javascript!


    Posting Permissions

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