Reply to: Spaces in the URLAugust 12, 2010 at 6:39 pm
I'm still a little confused because I'm not sure why having the %20 in the URL is a concern. Did your website people give a reason? You say the project manager doesn't allow spaces. So, because there are no spaces in the URL I'm not sure what the issue is. Or are they saying the %20 and space are identical (ie: it is not that the URL is illegal, it is that they think %20 is ugly)?
The thing that might be confusing everyone here is that different browsers display %20 differently in the address bar. In some browsers if a URL contains %20 it is rendered as %20 (IE is one) and some browsers “help” you by rendering the %20 as a space (presumably because this is easier to read and understand). Our code is telling the browser to use %20, it is the browser that is rendering a space, not us (this is true for FireFox). If you have both browsers installed and open the same output in each you should see what I mean.
I do, I did, and I do.
One thing that bothers me about the portion of code I posted before is that it checks for spaces before it takes the title from the TOC. At least, that's the way it appears to me. But I don't know enough about JS to even begin making revisions.
Anyway, if it does come up again as a concern, I have you post to refer to, so thanks for the info.