17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1423 Views |
-
rewriteHashlinks

5 June 2007 at 11:14am
Hi Folk
rewriteHashlinks (part of the sapphire/core/SSviewer.php file), is really useful (it adds the current URL any links starting with # (internal links e.g. <a href="#top">go to the top</a>) , but unfortunately, it does not apply to the content (the data that is entered in the CMS by the admin) of the page itself. How would you recommend I go about implementing it in the content itself?
Any hints much appreciated.
Nicolaas
-
Re: rewriteHashlinks

5 June 2007 at 11:46am Last edited: 5 June 2007 11:47am
Hi
This is what I have written in JS to fix it....
var currentUrl = location.href;
var As = document.links;
for(i = 0; i < As.length; i++) {
var A = As;
if(A.href) {
var afterHash = A.href.split("#")[1]
if(afterHash) {
if(afterHash.length > 0) {
A.href = currentUrl + "#" + afterHash;
}
}
}
}
| 1423 Views | ||
|
Page:
1
|
Go to Top |
