...

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



kippie
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:
<html>
<head>
<title> How about this? </title>
</head>

<body>

<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>



<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br>
<br>
<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>


<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<script type="text/javascript">
for (i in document.links){
document.links[i].target='_self';
}
</script>

</body>
</html>

Kippie

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

http://www.codingforums.com/showthread.php?s=&threadid=12773&highlight=mail.com

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

Beck
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>
<pre>



</pre>
<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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum