I have strange problem for which I can t think of a solution. I have written some Javascript code to load some content through a AJAX call which also does some animation. To make the website functional I use jQuery with History.js. This is the script:
(function (window, undefined) {
getContent(true); // Function that gets the initial content via AJAX and does some animation
// The parameter specifies that the call to the function is onload
History.Adapter.bind(window, statechange ,function(event){
getContent();
});
function getContent(onload){
if(onload == true){
// Do onload stuff. Only slightly differs from other event calls
// If there is no state given define default one ie home
alert( onload event triggered ); // For debug purposes
} else {
// Do other event stuff
alert( click event triggered ); // For debug purposes
}
}
somelinks.on( click ,a,function(){ // Setup some eventlisteners that push the state });
})(window);
在支持超文本5历史/国家预报(Firefox, Chrome)的浏览器中,这一作品是徒劳的。 该职能在装载或重载特定轮胎或点击活动中发挥作用。
然而,当我重新上载一页(例如,com/p/test)以及第二台老板(Content)(功能)时,它也发挥了作用(有汇合机)。 因此,在“第纳尔多”中,重载触发了上载事件的警示,但在电子计算机中,触发了上载事件和点击事件的警示。
我需要的是阻碍我制定守则或进行合乎逻辑的检查,以防止独立实体打电话给第二人。 我探讨了类似的问题(关键词:IE、历史、js等),但没有发现。
希望有些人能够帮助我解决这一问题。