开发者

Strategies to manage a single browser instance with no new tabs/windows?

开发者 https://www.devze.com 2022-12-10 09:28 出处:网络
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

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 alread开发者_JAVA技巧y 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 want to know about cross platform feasibility of this requirement.


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消