PDA

Click to See Complete Forum and Search --> : VS 2010 [RESOLVED] Kind of MVC probably JavaScript/JQuery Question


Bill Crawley
Jun 29th, 2011, 11:08 AM
HI All,

I am developing an MVC3 App. What I want to do is while the browser is open on my Application, I want to stop the user from switching to other windows can anybody recommend a way of doing this.

In classic asp you used to be able to get away with a hack something like:

<body onblur="self.focus();">

but under MVC this really screws the browser. does anybody have any other ideas.

Evil_Giraffe
Jun 29th, 2011, 07:07 PM
Given that that would be entirely client side, the use of classic ASP vs ASP.NET MVC seems somewhat tangential to the issue. Is it perhaps a more modern browser at fault rather than the server-side rendering technology?

Another question is what kind of pig-headed arrogant web application are you developing that you think preventing users switching to a different window on their desktop is in anyway acceptable?

Bill Crawley
Jun 30th, 2011, 03:10 AM
Evil_Giraffe....You dont need to be so rude.

It's not my application but a client I am workinig for and it's what they want. The application will be an extranet app that has financially sensitive info on it that also needs to be completed from start to finish. They want to ensure that while the users are using this app they do not get side tracked to other work.

Serge
Jul 28th, 2011, 11:18 AM
Unfortunately you cannot prevent the user from switching to other browsers, tabs. The only client-side event that exists is onBlur, but it doesn't work 100%, this event doesn't always fire when you close the browser window. The closest thing you can get is if you write your application in SilverLight but even with SilverLight you cannot prevent the user from switching to other tabs/browsers. The only thing you can do is to show them some kind of a message box, telling them to come back.