0
我有一個dijit樹,當點擊一個節點時,它會在中心內容頁面中加載一個html頁面。其中一個html頁面是一個登錄頁面,我想檢查一個cookie以查看它們是否已經登錄,所以如果頁面被重新加載,我可以適當地設置頁面。有沒有辦法在頁面加載時檢查cookie,或者比這更好的方法?由於在通過registrybyId加載頁面之前檢查cookie值設置href
我對樹的代碼是:
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
});
}