views:

170

answers:

1

All the browsing to this particular website should happen within the instance it was logged-in from...it should not allow side-by-side browsing if opened in a new tab or a new window. In other words if I am already browsing (and logged-in), and decide to open an new tab/window to browse the same site...my server should trap this, and report a friendly message. Is this possible? Also I what to know about cross platform feasibility of this requirement...

A: 

We put in a real quick and dirty for this on an internal system when IE7 came out due to the changes in the way session carried across tab instances from IE6.

This was ASP and used a combination of Session and Javascript, but could easily be ported to ASP.NET. Worked for us without a problem until we replaced it with registry hacks to change IE TAB behaviour.

If this is for an open system it's probably no good unless you are happy to require JavaScript but guess it might help you in some way.

<script language="JavaScript">
<%if session("window") = "" Then%>
 window.name = "LOCKwindow";
 <%session("window") = "set"%>
<%else%>
 if (window.name != 'LOCKwindow') {
  document.write('<h1>Sorry just one tab allowed</h1>');
  }
<%end if%>
</script>
Chris
how will this help if I navigate to some other page within the same site...?
deostroll
The session var ("window") is set to "set" so when this code executes on other pages it will enter the else and confirm the window.name is still set to 'LOCKwindow' which it will be as the window.name is not changed once set for that window, or at least in the browser config we ran at the time it worked fine.
Chris