I need to use the html5 appcache to store some web pages. Before using MVC I simply made this regular expression to check whether it is connected or not.
var offlinePages = /^\/(index|about|schedule|location).htm$/;
And in this loop I test:
var hideLinksThatRequireOnline = function () {
var allNavLinks = document.querySelectorAll("nav.page-nav a");
for (var i = 0; i < allNavLinks.length; i++) {
var href = allNavLinks[i].getAttribute("href");
if (!offlinePages.test(href)) {
allNavLinks[i].style.display = "none";
}
}
};
So far so good, but now I'm going to work with MVC, I'm going to have Controlers and Actions, so I had to change the expression:
var offlinePages = /^\/(Index|About).htm$/;
I did not put Controller / Index, because when I put the bar, it gave error in the regular expression. It just did not work, does anyone have any idea how to do it?