...

View Full Version : How to avoid new window opens when using anchors?



kippie
01-10-2003, 11:40 PM
In the HTML below I use some simple anchors. When this HTML is mailed to "mail.com" and opened in "mail.com" a new window opens each time you press on an anchor. The only good thing is that the position in the new window corresponds correctly to the position of the anchor. Is there a way to avoid the opening of a new window?

This is the HTML:
<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 4">
</head>

<body>
<a name="up"></a><a href="#anchor1">Press for Anchor1</a>
<p><a href="#anchor2">Press for Anchor2</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>
<a name="anchor1"></a>Here is Anchor1<br>
<a href="#up">Back-UP</a>
<br>
<br>
<br>
<a name="anchor2"></a>Here is Anchor2<br>
<a href="#up">Back-UP</a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>

</html>

Kippie

Ökii
01-10-2003, 11:48 PM
have you viewed source on the page once it's arrived at mail.com?

the html there would not effect a new window opening, so I'd presume mail.com parses the file and adds target="_blank" to every <a href it finds.

justame
01-11-2003, 02:14 AM
kip...
/me just a guesses® its like poot says 'cause its just a security® feature of the 'mail.com'...aka so thattt the owner of the site cant just a gothru® their 'visitor logs' n' click on the referring 'url' n' end up in the viewers email??? ummm sorta like how hotmail does it...:O)))

Borgtex
01-11-2003, 02:47 AM
you can try to use javascript:

<a href="#anchor1" onclick="self.location=this.href;return false">Press for Anchor2</a>

kippie
01-11-2003, 08:02 AM
Hi Okii,

You are right! mail.com adds target="_blank" to every <a> href it finds. Can I do anything about is, add some extra codes or so?

Kippie



Originally posted by Ökii
have you viewed source on the page once it's arrived at mail.com?

the html there would not effect a new window opening, so I'd presume mail.com parses the file and adds target="_blank" to every <a href it finds.

kippie
01-11-2003, 08:13 AM
Hi Borgtex,

I added what you suggested, but it does not work. As Ökii
suggested already mail.com adds target="_blank" to every <a href it finds. Can I do something against this?

Kippie


Originally posted by Borgtex
you can try to use javascript:

<a href="#anchor1" onclick="self.location=this.href;return false">Press for Anchor2</a>

Borgtex
01-11-2003, 12:19 PM
self.location isn't affected by target="_blank"; it should not open a new window... it's strange; maybe mail.com also removes the onClick event :(

kippie
01-11-2003, 12:24 PM
Hi Borgtex,

I have tried:

<a href="#anchor3" target="_self">Press for Anchor3</a><br><br>

and Mail.com changes it into:

<a target="_blank" href="#anchor3" >Press for Anchor3</a>

and I tried:

<a href="#anchor4" target="_self" onclick="self.location=this.href;return false">Press for Anchor4</a>

and Mail.com changes it into:

<a target="_blank" href="#anchor4" onFiltered="self.location=this.href;return false">Press for Anchor4</a>


Is there still anything I can do to counteract?

Kippie

Ökii
01-11-2003, 12:53 PM
try

<a href="javascript:document.location.replace(document.location.href+'#anchor');">

or similar.

Doubt it will work though

kippie
01-11-2003, 01:26 PM
Hi Okii,

Thanks for all your help. I tried what you said but there seems a problem or I make a mistake. I put your code around "Press for Anchor6". The thing is that after opening the file in IE6 it works only once. When pressing for the second time it fails somehow.

This is the HTML:
<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 4">
</head>

<body>
<a name="up"></a><a href="#anchor1">Press for Anchor1</a>
<p><a href="#anchor2">Press for Anchor2</a><br><br>

<a href="#anchor3" target="_self">Press for Anchor3</a><br><br>

<a href="#anchor4" target="_self" onclick="self.location=this.href;return false">Press for Anchor4</a><br><br>

<a href="javascript:void(window.location.href='#anchor5')">Press for Anchor5</a><br><br>

<a href="javascript:document.location.replace(document.location.href+'#anchor6');">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>
<a name="anchor1"></a>Here is Anchor1<br>
<a href="#up">Back-UP</a>
<br>
<a name="anchor2"></a>Here is Anchor2<br>
<a href="#up">Back-UP</a>
<br>
<a name="anchor3"></a>Here is Anchor3<br>
<a href="#up">Back-UP</a>
<br>
<a name="anchor4"></a>Here is Anchor4<br>
<a href="#up">Back-UP</a>
<br>
<a name="anchor5"></a>Here is Anchor5<br>
<a href="#up">Back-UP</a>
<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>
</body>

</html>

Kippie



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum