It's like this, once the pages are offline, you need a way to prevent broken links and references to other pages. Because I always use relative URI's for links in the web app, this is not too big of a problem. What is a problemn though is that my URI's contain queries, as in:
I use the URI to generate a filename, in order for the links to keep on working once the page is taken offline, and stored as a file. Unfortunately, the
?is not a valid character for a filename on Windows (wich is the target platform). So, I have substitute that for another character. I have to do that everywhere I link to a page, and of course when generating the filename.
window.open()method, wich takes, among others, an URI parameter. And I already wrapped that call in my own function to provide the appropriate options to the opened window. So, there already was a single point receiveing all the URI's, making it easy enough to substitute the
?character for the tilde
The only thing I needed now was a way of determining wheter the user was browsing offline. Because this is an Internet Explorers Solution, I used the
document.protocolproperty for that. It the protocol is
"Hypertext Transfer Protocol"we must use the
?; else, we must use the
~. Easy enough right?
As it turned out, the value returned by the
document.protocolproperty depends upon the language of the IE installation. On my developer machine, that's English (US); on the users machines, it's Dutch. In wich case the value returned by
"Hypertext Overdrachts protocol"or something like that.
It's of course all solvable, you just have to check for
document.protocol.indexOf("HyperText")==0, but I really don't see why, and obviously would not expect, such a property to be Language dependent.