Solved

Can I Ungroup a spawned Tab?

Posted on 2011-03-09
12
417 Views
Last Modified: 2012-08-14
I am creating a personal home page that has buttons that spawn a series of new tabs within by browser.  However, my home page becomes a part of the group of pages that I spawn.  So, I then need to right click my home page tab and select ungroup this tab.  

I'd like the home page to spawn the new tabs as a group, and then ungroup itself from the newly spawned group of pages using HTML or some other method.  How would I do this?  

Sample code is provided...

Thanks...RG
<br><a href="http://www.comics.com/" target="_blank"
        onclick="window.open(&quot;http://www.dilbert.com/&quot;);">
        Comic Pages</a>

Open in new window

0
Comment
Question by:RGRodgers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
12 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 35128303
I suggest something like this code.  It will spawn three new pages, then attempt to close the parent window.  However, IE will prompt the user to close the parent page: I don't think you can get around that.

<HTML>
<script>
function test()
{
	window.open ( "http://www.google.com" );
	window.open ( "http://www.yahoo.com" );
	window.open ( "http://www.thomsonreuters.com" );
	window.close();
}
</script>
<body>
<input type = "button" onClick ="test()" Value = "ClickMe">
</body>
</html>

Open in new window


Is this the kind of thing you are after?

HTH
0
 
LVL 8

Author Comment

by:RGRodgers
ID: 35128335
Thanks for the input.  I really don't want to close the parent page, just ungroup it.  Is that at all possible?  Thanks...RG
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 35129057
There is not going to be any standard way of doing that.  This is simply because you cannot be sure that the user has a browser that supports tabs: I admit, the majority of users are going to be, but you can turn it off in some browsers - what would you do in that circumstance?

I take it that when you say "undock", you mean "open page in a separate main frame window, where there is only one 'tab' in that window".

Am I right?  If so, you might be able to change your thinking:  instead of having the tabs

<home page>, <tab 1>, <tab 2>, <tab 3>

after the click, then trying to "move" <home page> to a new window,

how about you replace <home page> with <tab 1>, then force a new window to open displaying home page, i.e.

<tab 1, replacing home page>, <tab 2>, <tab 3>

Then the code becomes something like this:

function test()
{
        var currentPage = location.href; // Store current "home" page
	location.href =  "http://www.google.com"; // Replace current page
	window.open ( "http://www.yahoo.com" );
	window.open ( "http://www.thomsonreuters.com" );
	
        // Now we just need to force the current page, stored in "currentPage",
        // to open in a new window, not a new tab.  However, this is not easy, since
        // the user may have, in IE for example, specified "open new windows in new tabs" or similar setting...

}

Open in new window

0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 19

Expert Comment

by:mrwad99
ID: 35129074
If I misunderstand your notion of "ungroup", then please clarify, including some screenshots if I have badly misinterpreted it ;)
0
 
LVL 8

Author Comment

by:RGRodgers
ID: 35133251
mrwad99 -- I think you are going in the right direction.  I'll look it over tonight and see what I can do.  Since it is just my personal home page, I am less concerned about environments other than my own, but your input is interesting and I will consider it.  I'll let you know what I find.  Thanks again...RG
0
 
LVL 8

Author Comment

by:RGRodgers
ID: 35146964
mrwad99 -- I guess not.  This appears to open another window with the new group of tabs.  I want the tabs opened in the same window when I click the home page button.  I just want the home page to not be part of the tab group so that when I click another button, I generate a new tab group.  One button may be my home pages, another may be news, and another may be tools.  I want each of those all in the same window but under different groups.  Right now, I do it manually.  When I click any of the buttons, I then right click the home page and select Ungroup This Tab.  That way, if I click another button, it is a whole new tab group.  Thanks...RG
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 35147000
I am not following you.  Can you paste some screenshots of what you are currently seeing versus what you want to see, please?
0
 
LVL 8

Author Comment

by:RGRodgers
ID: 35148110
They are attached.  Let me know if you have questions.  Thanks...RG
ScreenShots.docx
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 500 total points
ID: 35149450
OK.  I have downloaded IE8 just for you :o) to try and figure this out: I can see a way to do it, but not the exact way you want.

The problem lies in how IE8 determines which "group" to put tabs in.  Visually, a group is merely a colour; different groups are determined by different colours, as you know.  But the thing is, any link clicked off page 'X' is going to be in the same group as page 'X'.  There is no getting around that.  Subsequently, any link opened in a new tab off of a link opened off page 'X' is going to be in the same group as page 'X'.  This is the problem.  There is no way to get around that.

You hence need to spoof IE so that it does not know where the links were opened from, which will force it into opening them all in new groups.  Going back to my example above, where I opened three links: except that I no longer close the current page - I instead "overwrite" it with Google.com -

<HTML>
<script>
function DoLoad()
{
	location.href = "http://www.google.com";
	window.open ( "http://www.yahoo.com" );
	window.open ( "http://thomsonreuters.com" );
}
</script>
<body onload = "DoLoad()">
</body>
</HTML>

Open in new window


If you save this as a HTML file in

C:\Documents and Settings\<YOUR USER NAME>\Favorites\Links (note that this might appear as "Favourites Bar")

(I called it "FirstGroup.html"), you will see it appears on the favourites bar.  Alternatively, you can just save it to

C:\Documents and Settings\<YOUR USER NAME>\Favorites\

if you dont want it on the bar, just in the Favourites menu.  Now, you can middle click the icon on the bar and it will open all three URLs as shown below.  

    First group
(Note: middle clicking will default to opening a new tab, thereby not overwriting whatever is on the currently active tab when you click: of course if you want to replace the current tab click normally).  Then if you create/save in the same place a second page, say with the following content:

<HTML>
<script>
function DoLoad()
{
	location.href = "http://www.microsoft.com";
	window.open ( "http://www.cnn.com" );
	window.open ( "http://bbc.co.uk" );
}
</script>
<body onload = "DoLoad()">
</body>
</HTML>

Open in new window


you can then middle click this link and it will open these three tabs in a different group, as shown below.

 Second group
If you like this idea, you need to create one HTML page for each "group", and add the appropriate URLs in.

I know this is not exactly what you want, but as mentioned above, you are not going to get that because of how IE determines whether or not a page should go in a 'new' group or not.  Since clicking a link on the favourites bar yields no "source" page, IE has no choice but to create a new group.

Hope this helps.
0
 
LVL 8

Author Closing Comment

by:RGRodgers
ID: 35150618
I do believe that this is the best possible solution even if it isn't exactly what I wanted.  As a matter of fact, the prior solution presents a viable option too.  Thanks...RG
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Make the most of your online learning experience.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question