How to make a child window on top?

I use window.open to open a child window from the parent window. I want the child window to stay on top so that the user can reference it while recording in the parent window. It can be done? I am using Firefox at the moment, but it will be a bonus if it works in all browsers.

+6
source share
6 answers

How about using a popup div instead of opening a new window?

+1
source

this popup is also good: DOMWindowDemo .

+1
source

yes, you can do this with this code that you provided onBlur = "self.focus ()" in the body for the child window

  //Parent page... <html> <body> <a href="#" onClick="window.open('two.html','sdvwsv','width=200,height=200');">here...</a> </body> </html> //Child page... <html> <body onBlur="self.focus();"> here... </body> </html> 
0
source
 <html> <script language="JavaScript"> <!-- function openWin(){ var myBars = 'directories=no,location=no,menubar=no,status=no'; myBars += ',titlebar=no,toolbar=no'; var myOptions = 'scrollbars=no,width=400,height=200,resizeable=no,top=10, left=10,'; var myFeatures = myBars + ',' + myOptions; var myReadme = 'This is a test.' var newWin = open('', 'myDoc', myFeatures); newWin.document.writeln('<form>'); newWin.document.writeln('<table>'); newWin.document.writeln('<tr valign=TOP><td>'); newWin.document.writeln('<textarea cols=45 rows=7 wrap=SOFT>'); newWin.document.writeln(myReadme + '</textarea>'); newWin.document.writeln('</td></tr>'); newWin.document.writeln('<tr><td>'); newWin.document.writeln('<input type=BUTTON value="Close"'); newWin.document.writeln(' onClick="window.close()">'); newWin.document.writeln('</td></tr>'); newWin.document.writeln('</table></form>'); newWin.document.close(); newWin.focus(); } --> </script> <body> <form> <b>Click the following button to open a new window: </b> <input type=BUTTON value="Open" onClick='openWin()'> </form> </body> 
0
source
 <html> <script language="JavaScript"> <!-- function openWin(){ var myBars = 'directories=no,location=no,menubar=no,status=no'; myBars += ',titlebar=no,toolbar=no'; var myOptions = 'scrollbars=no,width=600,height=400,resizeable=no,top=10, left=10'; var myFeatures = myBars + ',' + myOptions; var newWin = open('test.html', '', myFeatures); newWin.document.close(); newWin.focus(); } --> </script> <body> <form> <b>Click the following button to open a new window: </b> <input type=BUTTON value="Open" onClick='openWin()'> </form> </body> </html> </html> 
0
source

I struggled with this for a long time. This seems to be a bug in FF, but I noticed that after a new window opens, if I click on it, it will really focus and come back. However, the call to window.focus () did not work on it, so I guessed that this was happening too soon.

So, in the code of the new window, at the bottom of the page, I added

 setTimeout(function(){window.focus()},100); 

This doesn't sound like a solid practice, but if you need it to work ... 100mSec seems to be the lowest that works on my system.

0
source

All Articles