From 3acc5f10fbd8bff4914ba261861b1e39674c01f4 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Wed, 18 Feb 2015 20:40:24 +0100 Subject: Show a notFound page if the requested page does not exists --- router.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/router.js b/router.js index c498c0c..84c8ab1 100644 --- a/router.js +++ b/router.js @@ -19,14 +19,21 @@ } } }; - xhr.send(); + try { + xhr.send(); + } catch(err) { + errorHandler && errorHandler(err); + } }; function router() { var url = location.hash.slice(2) || 'presentation'; + var contentElement = document.getElementById('content'); fetchFile('Pages/' + url + '.md', function(contentMd) { - var contentElement = document.getElementById('content'); contentElement.innerHTML = markdown.toHTML(contentMd); + }, function() { + var notFoundPage = '