www.webdeveloper.com
Results 1 to 15 of 15

Thread: Getting a link to open two pages

  1. #1
    Join Date
    Jul 2005
    Posts
    3

    Question Getting a link to open two pages

    This may be a pretty simple question, but oh well

    I'm wondering, how would I get one link to open two different sites in two different windows? One could open in the same window, and the other be in a resource window, or both in separate windows/tabs, it doesn't really matter. I just need to be able to click on one link and get two pages to come up.

    Thanks in advance!

  2. #2
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Code:
    <a href="http://www.example.org" onclick="window.open('http://www.google.com','newwin');">click me</a>

  3. #3
    Join Date
    Jul 2005
    Posts
    3
    Thanks a million!

  4. #4
    Join Date
    Mar 2008
    Posts
    1

    open multiple website instead of just two

    I want to open multiple website instead of just two. tried to mopdify it but it doesn't work... Thanks in advance,

    Ice

  5. #5
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    You just add more window.open()s to the onclick sequence.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  6. #6
    Join Date
    Mar 2008
    Posts
    3
    @Kravvitz: Oh my god! Thank you very much.

  7. #7
    Join Date
    Jun 2009
    Posts
    11
    Hey, Im searching for the website number 1 to come up in a new window and website number 2 to open as a new tab in that window

  8. #8
    Join Date
    Feb 2010
    Posts
    1

    One Link and Framesets

    How does one have a user click a Library link (.lbi) which opens a new window which is a frameset which then loads another url into a target frame?

    I essentially have an online dictionary which specializes in music terminology. These terms are linked by means of a Library with .lbi type files. When the user clicks on the link a new window called music dictionary. It has 3 frames. There is a menu frame, a header frame and a data frame. The data frame is where content is presented. There are about 26 documents that can be imported into that data frame. Every term in the dictionary has a named anchor which is specifically what the Library entries refer to.

    Within the same site I present a series of articles which use terminology which is linked via the Library entries.

    When the user is reading an article and clicks on linked terminology, I wish to open the dictionary window and then immediately after that window opens the data frame loads the correct page and then scrolls the browser to the correct anchor. I use Dreamweaver and tried to do this with behaviors which apparently is disabled for .lbi files.

    I am sure there is a much more elegant way to accomplish what I am trying to do. Any suggestions? Any pointers are appreciated.

  9. #9
    Join Date
    Mar 2010
    Posts
    1

    open two different links images in one window on one click

    open two different links images in one window on one click
    For example
    there are two different images link but i want to open both the images in same window on one click i have tried open two different links or images on one click but they opened it in other window i want to open the both the images or links in same window or new window but they must open in one window

    what i m doing to open links in two other windows on one click

    <a href="tenders/<?php echo $arr[$i]['image_location']?>" onclick="window.open('correction/<?php echo $arr[$i]['image_correction']?>','newwin');"><img src="download_icon.gif" border="0" ALT="<?php echo $arr[$i]['organization_name'] ?>"></a></div></td>

  10. #10
    Join Date
    Nov 2010
    Posts
    3

    opening more than 2 pages

    Thanks for the advice, bit it didn't work for me.

    So I found this, which works a treat:

    <html>
    <head>
    <script type="text/javascript">
    function open_win() {
    window.open("http://www.java2s.com/")
    window.open("http://www.facebook.com/")
    window.open("http://www.google.com/")
    window.open("http://www.yourcorset.com/")
    window.open("http://www.mythongoftheday.com/")
    window.open("http://www.boo.by/")
    window.open("http://www.searchandsocialmediamarketing.co.uk/")
    window.open("http://www.posterous.com/")
    }
    </script>
    </head>
    <body>
    <form>
    <input type=button value="Open Windows" onclick="open_win()">
    </form>
    </body>
    </html>

  11. #11
    Join Date
    Mar 2010
    Location
    Singapore
    Posts
    367
    I think open multiple windows will annoy a lot of users. It is like spamming the users where an innocent click pop up so many windows and most of the times, user spent time closing them one by one

  12. #12
    Join Date
    Nov 2010
    Posts
    3

    You're right

    Quote Originally Posted by sohguanh View Post
    I think open multiple windows will annoy a lot of users. It is like spamming the users where an innocent click pop up so many windows and most of the times, user spent time closing them one by one
    I agree fully. This would be like spamming the user and I would never do that.

    I needed it for me. To test something. I need to open 23 social media sites every day for a few days to make sure my post was being formatted correctly. This was just a time saving thing, and I like playing with code to see what's possible.

    After all, code is poetry

  13. #13
    Hello Kravvitz,

    Amazing..., thanks a lot this useful tip.

  14. #14
    Join Date
    May 2011
    Posts
    2

    Question One more question

    Hi all,

    I have one different question i need a command which will open a multiple website while typing the domain name or clicking the domain name and later it should automatically close the opened pages after loading the pages.

    For eg:

    I am typing www.google.com, so google page will load and in the same time facebook and yahoo will also open and after 10 seconds it should close the page of facebook and yahoo automatically.

    Is it possible?

    Thanks

  15. #15
    Join Date
    Dec 2012
    Posts
    3
    Quote Originally Posted by theteamplayer View Post
    Thanks for the advice, but it didn't work for me.

    So I found this, which works a treat:

    <html>
    <head>
    <script type="text/javascript">
    function open_win() {
    window.open("http://www.java2s.com/")
    window.open("http://www.facebook.com/")
    window.open("http://www.google.com/")
    window.open("http://www.yourcorset.com/")
    window.open("http://www.mythongoftheday.com/")
    window.open("http://www.boo.by/")
    window.open("http://www.searchandsocialmediamarketing.co.uk/")
    window.open("http://www.posterous.com/")
    }
    </script>
    </head>
    <body>
    <form>
    <input type=button value="Open Windows" onclick="open_win()">
    </form>
    </body>
    </html>
    I'm using this and it works great! However, I have two of these links on the same page and when I click on the first one the 2 websites that the second link are supposed to open, are opened. How do I separate the scrips or keep the second script from taking over the first one?

    Thank you

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

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



Recent Articles