2012-07-25 43 views

回答

0

JS开箱即可允许请求previous URL,但不适用于以前的标题。

您可以使用其他自定义实现。例如与饼干:

// code simplified and no tested 
function pushHistory() { 
    var history = getHistory(); 
    var newHistory = { 
    url: window.location.pathname, 
    title: $("title").text() 
    } 
    history.push(newHistory); 

    $.cookie("app.history", JSON.parse(history)); 
} 

function getHistory(){ 
    return JSON.parse($.cookie("app.history")); 
} 

注:我使用jquery-cookie plugin以简化代码。

现在,您可以在用户访问的每个页面中拨打pushHistory(),并在“app.history”cookie中显示相应信息。