Web Analytics Made Easy -
StatCounter A link opens a new window and simeltaneously changes current window - CodingForum

Announcement

Collapse
No announcement yet.

A link opens a new window and simeltaneously changes current window

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A link opens a new window and simeltaneously changes current window

    Hello,

    I want to have a link that changes the current browser window, but also opens a popup window.

    Could someone advise on how to do this?

    Thanks
    Eternity

  • #2
    <a href="ULR1" target="_blank" onclick="document.location.href='ULR2'"

    Comment


    • #3
      <a href="javascript:void(window.open('popup.html','_blank','popup's attributes');document.location.href='newpage.html')">

      NOTE: when copying the code, remove the empty space between java and script. This is a weird Forum's hobby, to split the word javascript if in a tag
      KOR
      Offshore programming
      -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

      Comment


      • #4
        or:

        <a href="newpage.html" onclick="window.open('popup.html','_blank','attributes')">Open 2 pages</a>

        If javascript is disabled or popup blocker is installed, at least one page (newpage.html) will be opened instead of nothing at all.
        Glenn
        vBulletin Mods That Rock!

        Comment


        • #5
          actually a popup blocker shouldn't block that, since it is done from a user action.

          wouldn't this work and most defintly avoid a popupblocker?
          <a href="ULR1" target="_blank" onclick="document.location.href='ULR2'">click</a>

          Comment


          • #6
            Let me talk about the scenario where javascript is disabled.
            Depending on which page holds more importance to the user, one of our solutions is better than the other. If the popup page is more important to the user, then your code is the better solution but if the next page in the current window is more important than the popup, then my code is better. But if javascript availability is not considered and you want to customize the popup window (no address bars, menu bars, etc), my code is still the way to go.
            Glenn
            vBulletin Mods That Rock!

            Comment

            Working...
            X