AlexC Posted March 7, 2014 Share Posted March 7, 2014 Using target="_blank" in <a>..</a> nominally opens a new window. In browsers with a tab facility however it usually opens a new tab. You can usually pick up a tab and move outside the browser window to create a completely new window, but how do you force a completely new window rather than just a new tab f romthe start? I haven't come up with search criteria that give me anything other than target="_blank". Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted March 7, 2014 Share Posted March 7, 2014 You can't do it with HTML. It's up to the user to decide how they want their links to behave, most browsers have an option for the users to choose how they want new windows to appear. Link to comment Share on other sites More sharing options...
AlexC Posted March 7, 2014 Author Share Posted March 7, 2014 OK, but quite few websites force the creation of new windows, so is this via java script? Link to comment Share on other sites More sharing options...
Ingolme Posted March 7, 2014 Share Posted March 7, 2014 Javascript usually will create a new window when you set width and height parameters in the window.open() method. Are you sure your users would prefer your website to open a new window rather than a tab? You must try to make your website easy to use. Link to comment Share on other sites More sharing options...
AlexC Posted March 8, 2014 Author Share Posted March 8, 2014 Yes, easy of use is the problem. For the post 60 generation, with which I am dealing, when information disappears there is a tendency to think that it is not available rather than not visible. The current modes of operation used on the web are not obvious to a lot of older people and as soon as they manage to learn some they have a habit of changing. Currently they click on a link to create a working page, which has to run on a different server, and loads in a new tab. When wanting to return to the original page, they seem to use the tab OK, but when trying to get back to the working page, they click on the link again in the original page to get back to the working area, rather than just the tab, which just sends them through a new start up loop and creates another tab. Opening a new window might make it more obvious that the two pages co-exist and also allows easier cross-reference between the data in the two pages. I could just stay in the original tab, but that creates a completely different set of usability issues. No perfect solutions. Link to comment Share on other sites More sharing options...
Ingolme Posted March 8, 2014 Share Posted March 8, 2014 I think this can be solved with a bit of Javascript. You can use window.open() to create a new tab (not window) but when the user clicks the link it will focus the window instead. var win;// Execute openTab when the link is clickedfunction openTab() { // If there's already a window, focus it if(win) { win.focus(); } else { win = window.open("document.html"); } return false;} If you want to get a bit more into Javascript, it would be convenient to use the event object and methods like preventDefault() to stop the link from activating when Javascript is available but I'm just putting a simple code here to show the idea. Link to comment Share on other sites More sharing options...
MarkT Posted March 8, 2014 Share Posted March 8, 2014 You can do it in HTML. It's using the target attribute. For example; <a href="#" target="_blank"> does a new tab or window. _blank Opens the linked document in a new window or tab _self Opens the linked document in the same frame as it was clicked (this is default) _parent Opens the linked document in the parent frame _top Opens the linked document in the full body of the window framename Opens the linked document in a named frame Source; http://www.w3schools.com/tags/att_a_target.asp Link to comment Share on other sites More sharing options...
Ingolme Posted March 8, 2014 Share Posted March 8, 2014 You can do it in HTML. It's using the target attribute. For example; <a href="#" target="_blank"> does a new tab or window. _blank Opens the linked document in a new window or tab _self Opens the linked document in the same frame as it was clicked (this is default) _parent Opens the linked document in the parent frame _top Opens the linked document in the full body of the window framename Opens the linked document in a named frame Source; http://www.w3schools.com/tags/att_a_target.asp I would recommend reading the thread more thoroughly before trying to answer. Link to comment Share on other sites More sharing options...
MarkT Posted March 9, 2014 Share Posted March 9, 2014 I would recommend reading the thread more thoroughly before trying to answer. My target="_blank" works in a new tab, but I don't see why you need a new window. If I'm honest. Link to comment Share on other sites More sharing options...
AlexC Posted March 10, 2014 Author Share Posted March 10, 2014 Haven't tried your latest suggestion with the JavaScript, but did try a simple window.open. Nothing happened. So went back to the simple 'try it' examples in W3Schools and substituted my link - all OK. The difference to the W3S example is that I am trying to activate the link from a list item in a drop down menu and the W3S example is via a button. So either this is not possible or my construct is way off, First tried, <li><a onclick="NewWindow()">Test LINK</a><li> having just substituted the onclick for the original href and having put the href link into the NewWindon function. No result. Then tried the onclick within the <li>, taking out the <a></a>. No result. Then tried, out of interest, putting a button in place of the <a></a> construct. No result. The only affect of the last two was to muck up the formatting of the menu for that item. So then tried putting the original href back and adding the onclick within the <a></a> and then the <li>. No result. So if it is possible to get an onclick event into a menu item structured with a series of unordered lists, what's the syntax? Thanks. Link to comment Share on other sites More sharing options...
thescientist Posted March 10, 2014 Share Posted March 10, 2014 are you checking for errors in the console? Are you sure the function name is correct? Link to comment Share on other sites More sharing options...
AlexC Posted March 11, 2014 Author Share Posted March 11, 2014 Thanks for everyone's suggestions, but I'm giving up on this for the present. I've tried numerous variations in my code and nothing seems to work. When I have cut and pasted my very basic code into the W3schools 'try it' pages (which I used as the basis in the first place), sometimes it works and sometimes it doesn't. It would have been nice if it worked, but plenty of other things to do. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now