我有一个 dijit 树,当单击一个节点时,它会在中心内容页面中加载一个 html 页面。其中一个 html 页面是登录页面,我想检查 cookie 以查看他们是否已经登录,因此如果页面重新加载,我可以适当地设置页面。有没有办法在页面加载时检查 cookie,或者比这更好的方法?谢谢
我的树代码是:
TOCSet: function (TOCStore) {
var myModel = new ObjectStoreModel({
store: TOCStore,
query: { root: true }
});
// Create the Tree.
var tree = new Tree({
model: myModel,
onClick: function (item, node, evt) {
// Get the URL from the item, and navigate to it
evt.preventDefault();
var href = item.url;
registry.byId('Content').set('href', href); //set the page on node clicks
}
});
tree.placeAt("TOC");
tree.startup();
ready(function () {
registry.byId("Content").set("href", "Login.htm");//set the login page at start
});
}