Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force a browser window to always be on top and in focus

Is there a way to force a browser window to always be on top and in focus? I am working on a project that I need to have the browser window on top and in focus all the time except when closing the browser window. I have tried a few things through javascript, but have not had any success keeping the window in focus.

I am not trying to do this to be forceful to the user. I am working on a project to implement online testing and I don't want the user to be able to switch away to look up answers on the web.

like image 991
Mark Avatar asked Jan 21 '26 13:01

Mark


1 Answers

You will need to install a windows application on the clients machine which will force the browser to be on top. This is the only way.

If you are using IE, you can open a Modal dialog which will always be on top and in focus but only while in that browser session, the user is free to switch applications.

Edit: If you are writing a testing application, you are honestly better off just putting a reasonable time limit on each question. trying to prevent them from looking up the answers is worthless. What if they have two machines side by side? What if they have their buddy next to them helping with the answers. You are going to have to go with the honor system on this one.

like image 91
Bob Avatar answered Jan 24 '26 01:01

Bob