L.Adlon Posted July 2, 2014 Share Posted July 2, 2014 (edited) If I have a hyperlink to another page, and have it set with target="_blank", does the newly opened page always get focus (...or, maybe I'm using that term wrong... will it always open up and be displayed on top of the previous page)? I always assumed it did, and it always seemed to. But, as I've been working on one of my sites today, and tested one of the links, I think it opened the new page, but kept focus/display on the previous page. So, I'm wondering if this is ever possible, and if so, what can be done to assure the new page is always displayed. This was on Win7, BTW. [Additional note] Ya, it just happened again. Seems random. I have a link to a YouTube page (set to target="_blank"). I clicked on it. It opens a new browser page (YouTube page), plays the video, but then the tab for the previous window suddenly gets 'focus' (sorry if that's the wrong term), and the page I came from is displayed, rather than the newly opened YouTube one. I tried it again, and it worked fine (new page stayed on top). What's the deal there?! Edited July 2, 2014 by L.Adlon Link to comment Share on other sites More sharing options...
Ingolme Posted July 3, 2014 Share Posted July 3, 2014 I'm trying to find out, but the specification does not seem to say anything about whether the target window or frame will be focused. If it says nothing, then you can't count on all the browsers behaving the same way. I think it's likely that the user can choose whether to focus new windows or not in the browser settings. Link to comment Share on other sites More sharing options...
newseed Posted July 3, 2014 Share Posted July 3, 2014 Ingolme is correct. It's defined by the user's browser's settings. Link to comment Share on other sites More sharing options...
L.Adlon Posted July 18, 2014 Author Share Posted July 18, 2014 Ya, but the weird thing is, on my browser, the behavior seemed random. Sometimes, the newly opened window remained on top (new browser window was on top of the first one). On other (seemingly random) occassions, the new browser window would open, the content displayed, but then the first window would suddenly go on top of it again (within a second or so). I've never seen that kind of behavior before, as the new window (previously) always displayed on top, and never switched back to the first one again. Maybe I'm using the term 'focus' the wrong way, as I think that applies more to which ELEMENT on the screen currently is 'highlighted'/active. Whatever the case, my main concern is that (seemingly randomly) the first browser window suddenly 'goes on top of' the newly opened second browser window. If it IS in fact a browser setting, why would it only do it sometimes? Link to comment Share on other sites More sharing options...
Ingolme Posted July 20, 2014 Share Posted July 20, 2014 I can't tell why it would work differently at random times. Focus is the proper word for when a window is currently selected by the operating system or when a tab is currently in front. The window object has a focus() method (and a blur()) method, but can only be called by another window that created the current window. Link to comment Share on other sites More sharing options...
L.Adlon Posted July 21, 2014 Author Share Posted July 21, 2014 Yep, I can't say I've ever seen this kind of thing before... Normally, it just would open up the new window, and that would be on top of the old one. I thought maybe it was some weird cache/buffer reaction, but I don't know. 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