iwato Posted August 28, 2009 Share Posted August 28, 2009 QUESTION ONE: Is it possible for the author of a webpage to dictate to the viewer whether a new page opens in a new tab or window?QUESTION TWO: Is there some way to detect how a viewer opens a hyperlinked page -- in new tab, the same tab, or a different window?BACKGROUND: I have designed my pages in a way that distinguishes between pages contained within the same domain and those that are not. As a result of this design, I want to be able to force my users to open hyperlinked pages that are not in my domain in either a new window or new tab. Within the industry new tabs are generally preferred over new windows.Roddy Link to comment Share on other sites More sharing options...
Ingolme Posted August 28, 2009 Share Posted August 28, 2009 Generally, window.open() (Javascript) and the target attribute automatically open windows in new tabs rather than new windows. The only way to open a new window is to use window.open and assign a width and height to the resulting window.You can't tell if the new window is a real window or just a tab, but with Javascript you can check if window.opener exists or not. window.opener will tell you if a window has been opened from another window or not. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.