Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32

Thread: How to Open links in New Tab of browser with Javascript or VBscript

  1. #21
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by tonywe View Post
    Just go to: http://browservulsel.blogspot.com/20...ener-user.html

    this guy seems to have cracked it............I hate it when people say something cant be done, its so anoying.
    That appears to be a customization for the greesemonkey FF browser extension. We already knew that users could customize their own browsers to behave as desired. How (if at all) does that work on a live web page for all FF and IE 7 users? If we can get everybody to switch to FF and install GM, it might just work out.
    Last edited by jscheuer1; 04-27-2007 at 03:37 AM. Reason: add clarity
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #22
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    greasemonkey is just an extention that appends your own JS docs to the head section, they work like any normal script.

    Unless I've been misled.

    *looks slowly around the room, backs out of the door*
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  3. #23
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by boxxertrumps View Post
    greasemonkey is just an extention that appends your own JS docs to the head section, they work like any normal script.

    Unless I've been misled.

    *looks slowly around the room, backs out of the door*
    Not so in this case. The script uses:

    Code:
    GM_openInTab(a.href);
    to open in a tab. That looks like a GM proprietary function to me as, 'GM_openInTab' occurs nowhere else in the code.

    If you can put up a demo page and show me how it works in FF and IE 7, then I will be convinced.

    Quote Originally Posted by tonywe
    I hate it when people say something cant be done, its so anoying.
    I don't mind it so much as solutions that don't work.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #24
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I hate it when people say something cant be done, its so anoying.
    It didn't work either. It kept pointing me in the same page.
    - Mike

  5. #25
    Join Date
    Apr 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So guys are we saying that we don't have any answer to this???

  6. #26
    Join Date
    Mar 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What you want can u write me details.do u want to open a page in new tab by javascript.
    if yes then i can help you for Firefox but i have no idea on IE. i am searching for IE.

  7. #27
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Quote Originally Posted by jscheuer1 View Post
    I may be over thinking this. Just use:

    HTML Code:
    <a href="some.htm" target="_blank">Link Text</a>
    That's, I believe, the best you can do.
    (I know it is an old thread but..)

    Thanks a lot. I have been looking on the web for 2 days but found nothing that worked! This is the only code that really works! and works great!

    Thanks a lot!

  8. #28
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by jscheuer1 View Post
    I may be over thinking this. Just use:

    HTML Code:
    <a href="some.htm" target="_blank">Link Text</a>
    That's, I believe, the best you can do.
    Quote Originally Posted by Matey View Post
    (I know it is an old thread but..)

    Thanks a lot. I have been looking on the web for 2 days but found nothing that worked! This is the only code that really works! and works great!

    Thanks a lot!
    No problem. Now, the original question was wanting to open in a new window, except if the browser has tabbed browsing, then in that case open a new tab. Most browsers will just behave that way if you ask for the new window in the most generic terms, either as quoted above or, using javascript:

    HTML Code:
    <a href="whatever.htn" onclick="window.open(this.href);return false;">Link Text</a>
    What you cannot do is force a new window or tab if the browser is using other than its default settings for whatever it is that you want. You can force a new window for all in some cases (for users with default settings), but almost never (the exception being if the user has some add on that can be tricked into thinking your script is really the user's own self configuration script) force a new tab.

    Just to be clear, whatever you try, if the user has their browser configured to maintain control of such things, the user will win the 'battle'.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #29
    Join Date
    Oct 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Could it possibly be as simple as this?

    HTML Code:
    form = document.createElement("form");
    form.method = "GET";
    form.action = "http://www.your.link.url.com";
    form.target = "_blank";
    document.body.appendChild(form);
    form.submit();

  10. #30
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by ekotaktik View Post
    Could it possibly be as simple as this?

    HTML Code:
    form = document.createElement("form");
    form.method = "GET";
    form.action = "http://www.your.link.url.com";
    form.target = "_blank";
    document.body.appendChild(form);
    form.submit();
    No. For one, that's not simple. For another, all of the caveats that I mentioned in my previous post will still apply.

    Also note that you have an undeclared variable in the global scope (form). Oh, and it's not HTML code.

    However, none of that's to say it won't work in some cases. Without testing I cannot say for sure, but it looks workable. Recommended? Definitely not.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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