diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-15 01:29:36 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-15 01:29:36 +0000 |
commit | 9e8552c5a1d10e56bb152a719981b5b02daea9ec (patch) | |
tree | a870d12f9bdb24858fd9d9e820f1a958bdce8079 | |
parent | 176fdc1967998ff7fac4584cb22bb308c38c660f (diff) |
web commit by http://per.bothner.myopenid.com/: translate foo/index.html to foo using JavaScript
-rw-r--r-- | doc/patchqueue/index.html_allowed.mdwn | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/patchqueue/index.html_allowed.mdwn b/doc/patchqueue/index.html_allowed.mdwn index 4112b0129..16ff291ee 100644 --- a/doc/patchqueue/index.html_allowed.mdwn +++ b/doc/patchqueue/index.html_allowed.mdwn @@ -171,6 +171,20 @@ I'll attach an updated and modified version below. --[[Joey]] >>> unless you also want to serve the same copy over the Web, which I >>> doubt. --[[tuomov]] +* I suggest keeping the links using foo/index.html in the html file, but use + JavaScript to fix the links onload time - but only if the protocol is http or https. + This provides nice links without the "index.html" when served by a + web server, but degrades nicely when using a file: url, or when JavaScript + is disabled. --Per Bothner + + function fixLinks ( ) { + var scheme = location.protocol; + if (scheme!="http:" && scheme!="https:") return; + var links = document.getElementsByTagName("a"); + for (var i = links.length; --i >= 0; ) + links[i].href = links[i].href.replace(/[/]index.html/,""); + } + * Some of the generated links are missing the trailing / , which is innefficient since it leads to a http redirect when clicking on that link. Seems to be limited to ".." links, and possibly only to |