2
我使用Sammy.js加載了一個模板名稱,但是如果找不到該文件,我想將用戶重定向到另一個頁面。基本上,我有:如何使用Sammy.Template檢測和處理404錯誤?
this.use(Sammy.Template, 'tpl');
this.get('#/:page', function() {
// render a template
// this.load()
this.render('templates/' + this.params['page'] + '.tpl').swap();
});
我該如何處理404錯誤?