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 10 of 10
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to avoid new window opens when using anchors?

    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

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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)))

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you can try to use javascript:

    <a href="#anchor1" onclick="self.location=this.href;return false">Press for Anchor2</a>
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by kippie; 01-11-2003 at 08:05 AM.

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #7
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #8
    Regular Coder
    Join Date
    Jul 2002
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try

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

    or similar.

    Doubt it will work though
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #10
    Regular Coder
    Join Date
    Jul 2002
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

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