View Full Version : How to force anchors not to open new window?

03-03-2003, 12:18 AM
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){



03-03-2003, 02:08 AM
you asked the same question some time ago:


so I suppose that actually there is no solution for the problem :(

03-03-2003, 12:20 PM
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.