Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

More of a script modification than of a script creation : opening it in a new tab


I have a script I use as a bookmarklet and what I'd wish is that the result opens in a new tab instead of the current one.
It's a basic script intended to Google Translate either highlighted text if applicable otherwise the whole page.
Works OK except that I'd prefer the Google Translated page to appear in a new tab.

Here it is :


Many thanks :)


  • Instead of

    location.href = URI;

    try, '_blank');

    As long as you normally divert new windows to a new tab instead, that should work.
  • Thanks, Jefferson Scher, for your help.

    I tried replacing
    location.href = URI;
    with, '_blank');
    and indeed the result opened in a new tab, but the original (current tab) was blankened with only the mention of javascript at the top ...


    Maybe have I incorrectly replaced the setting?
    But your suggestion got me on the right path, and I remembered another bookmarklet I had which opens result in a new tab, with

    I have the following which runs fine : original tab is preserved, result opens in a new tab :


    Thanks again, because the fact is I had no clue where to even start from (I couldn't "conceptualize" the process). I'm no coder!
    Now i'll know better how to dig in the stuff!!
Sign In or Register to comment.