jquery idletimeout和store.js跨多个浏览器选项卡

jquery idletimeout和store.js跨多个浏览器选项卡,jquery,asp.net-mvc,Jquery,Asp.net Mvc,我在MVC5应用程序中使用jquery和插件。 我尝试了很多,但仍然无法运行该示例。 如何使用 我认为Store.js似乎是为Node.js设计的? 如何在MVC5中使用这两个插件 我的代码写在下面: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" type="text/javascript"></script> <script src="//ajax.googlea

我在MVC5应用程序中使用jquery和插件。 我尝试了很多,但仍然无法运行该示例。 如何使用

我认为Store.js似乎是为Node.js设计的? 如何在MVC5中使用这两个插件

我的代码写在下面:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js" type="text/javascript"></script>
<script src="~/Content/app/FrontEnd/js/json.js"></script>
<script src="~/Content/app/FrontEnd/js/require.js"></script>
<script src="~/Content/app/FrontEnd/js/store.js"></script>
<script src="~/Content/app/FrontEnd/js/jquery-idleTimeout.min.js"></script>` $(document).ready(function () {      
        //var engine = require('../src/store-engine')
        //var store = localStorage;
        //if (store.se) {
        //    store.set('idleTimerLoggedOut', true);
        //} else {
        //    alert('Dependent file missing. Please see: https://github.com/marcuswestin/store.js');
        //} 

        $(document).idleTimeout({
            redirectUrl: '/logout',      // redirect to this url on logout. Set to "redirectUrl: false" to disable redirect

            // idle settings
            idleTimeLimit: 1200,           // 'No activity' time limit in seconds. 1200 = 20 Minutes
            idleCheckHeartbeat: 2,       // Frequency to check for idle timeouts in seconds

            // optional custom callback to perform before logout
            customCallback: false,       // set to false for no customCallback
            // customCallback:    function () {    // define optional custom js function
            // perform custom action before logout
            // },

            // configure which activity events to detect
            // http://www.quirksmode.org/dom/events/
            // https://developer.mozilla.org/en-US/docs/Web/Reference/Events
            activityEvents: 'click keypress scroll wheel mousewheel mousemove', // separate each event with a space

            // warning dialog box configuration
            enableDialog: true,           // set to false for logout without warning dialog
            dialogDisplayLimit: 20,       // 20 seconds for testing. Time to display the warning dialog before logout (and optional callback) in seconds. 180 = 3 Minutes
            dialogTitle: 'Session Expiration Warning', // also displays on browser title bar
            dialogText: 'Because you have been inactive, your session is about to expire.',
            dialogTimeRemaining: 'Time remaining',
            dialogStayLoggedInButton: 'Stay Logged In',
            dialogLogOutNowButton: 'Log Out Now',

            // error message if https://github.com/marcuswestin/store.js not enabled
            errorAlertMessage: 'Please disable "Private Mode", or upgrade to a modern browser. Or perhaps a dependent file missing. Please see: https://github.com/marcuswestin/store.js',

            // server-side session keep-alive timer
            sessionKeepAliveTimer: 600,   // ping the server at this interval in seconds. 600 = 10 Minutes. Set to false to disable pings
            sessionKeepAliveUrl: window.location.href // set URL to ping - does not apply if sessionKeepAliveTimer: false
        });
    });`

`$(文档).ready(函数(){
//var engine=require(“../src/store engine”)
//var-store=localStorage;
//if(store.se){
//store.set('idleTimerLoggedOut',true);
//}否则{
//警报('相关文件丢失。请参阅:https://github.com/marcuswestin/store.js');
//} 
$(文档).idleTimeout({
redirectUrl:“/logout”,//注销时重定向到此url。设置为“redirectUrl:false”可禁用重定向
//空闲设置
idleTimeLimit:1200,//“无活动”时间限制(以秒为单位)。1200=20分钟
idleCheckHeartbeat:2,//以秒为单位检查空闲超时的频率
//注销前要执行的可选自定义回调
customCallback:false,//设置为false表示没有customCallback
//customCallback:function(){//定义可选的自定义js函数
//在注销前执行自定义操作
// },
//配置要检测的活动事件
// http://www.quirksmode.org/dom/events/
// https://developer.mozilla.org/en-US/docs/Web/Reference/Events
activityEvents:'单击按键滚动滚轮鼠标滚轮鼠标移动',//用空格分隔每个事件
//警告对话框配置
enableDialog:true,//设置为false以在没有警告对话框的情况下注销
dialogDisplayLimit:20,//20秒用于测试。在注销(和可选回调)之前显示警告对话框的时间(秒)。180=3分钟
dialogTitle:'会话过期警告',//也显示在浏览器标题栏上
dialogText:'因为您一直处于非活动状态,您的会话即将过期。',
dialogTimeRemaining:“剩余时间”,
dialogStayLoggedInButton:'保持登录',
dialogLogOutNowButton:“立即注销”,
//错误消息,如果https://github.com/marcuswestin/store.js 未启用
errorAlertMessage:'请禁用“专用模式”,或升级到现代浏览器。或者可能缺少从属文件。请参阅:https://github.com/marcuswestin/store.js',
//服务器端会话保持活动计时器
sessionKeepAliveTimer:600,//以秒为单位在此间隔ping服务器。600=10分钟。设置为false可禁用ping
sessionKeepAliveUrl:window.location.href//将URL设置为ping-如果sessionKeepAliveTimer:false,则不适用
});
});`
我收到以下错误消息:


请禁用“私人模式”,或升级到现代浏览器。或者可能缺少一个从属文件。请参阅:

看起来您缺少依赖项。尝试下载jquery.min.js和jqueryui.min.js,并将它们作为您希望附加的其他脚本添加到您的类中

例如:

    <link type="text/css" rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
    <script src="~/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="~/Scripts/jquery-ui-1.8.24.min.js" type="text/javascript"></script>
    <script src="~/Scripts/store.everything.min.js" type="text/javascript"></script>
    <script src="~/Scripts/jquery-idleTimeout.min.js" type="text/javascript"></script>