Tuesday, March 1, 2011

JavaScript: Open New Tab

I really wish there was a feature in JavaScript that enabled me to open a new tab:

javascript:tab.open("GoogleTab", "http://www.google.com/", true);

Where the first argument is the name of the tab, second argument is the link, and the third argument is whether or not the tab should be switched to when it is opened. The feature could lead to danger for some malicious code, but it won't be any different from pop-up windows. In fact, it could be less dangerous, considering the fact that programmers are getting crafty enough to hide pop-up windows behind the main window, allowing the user to essentially become unaware of its presence, and allowing it to do whatever it wants (unless the user has good virus protection). With a tab, you can see when it's opened.

javascript:tab.open("HomePage", HOME, false);

This could also be useful, where the method instructs the client to open a tab with the set homepage, but to not switch to it. They may also use "about:blank" for a blank page.

javascript:tab.close("GoogleTab");
javascript:tab.switchTo("GoogleTab");
javascript:tab.switchTo("GoogleTab").location.href="http://images.google.com/";
javascript:tab.open("DuplicatePage", location.href, true);

2 comments:

  1. interesting, I could use this.

    ReplyDelete
  2. This isn't real. This is just something I'd like to happen.

    ReplyDelete