我们的网站有一些像HTTPS帐户设置的帐户,当我们导航到HTTP页面时,我们正在更改javascript中的url并且整个页面正在重新加载.. 我们的网站是在Backbone.js中创建的单页面应用程序,有没有更好的方法来处理它?</ p>
这就是我们正在做的事情。
ACCELERATOR.Router = Backbone.Router.extend({
routes :{
'categoryHome(/:Type)(/:catId)' : 'homeAction',
'account_settings(/:nickname)': 'accountSettingsAction',
'trolley': 'trolleyAction',
'*actions': 'defaultAction'
},
homeAction : function(){
//some action
},
accountSettingsAction : function(){
if (location.protocol=='http:') { // cheking for https page
var domain = document.domain;
var accountPage = "https://"+domain+ "/account.shtml#/account_settings";
window.location.assign(accountPage);
}elase{
}
},
trolleyAction : function(){
if (location.protocol=='https:') { // cheking for https page
var domain = document.domain;
var trolleyPage = "http://"+domain+"//home.shtml#/trolley";
window.location.assign(trolleyPage);
}elase{
}
}
});
有没有更好的方法来解决这个问题?。
答案 0 :(得分:0)
如果您有敏感信息,请不要混淆,只需坚持 HTTPS 或从单页转到另一页以处理敏感交易。
这完全取决于您在应用程序中的工作流程以及有意义的内容。