Search code examples
htmlencodinghyperlinkanchorhref

Why are some of my HTML internal links working and others not?


Help, I am totally new to this world.

I am making a menu bar on front page to with links to other pages on the site, here is example of code:

<ul id="menu">
<li><a href="file:///Users/tamborine/Downloads/about_page.htm">About</a></li>
<li><a href=“file:///Users/tamborine/Downloads/the_therapist_page.html”>The Therapist</a></li>
<li><a href=“file:///Users/tamborine/Downloads/pay_what_you_can_page.htm”>Pay what you can</a></li>
<li><a href=“file:///Users/tamborine/Downloads/projects_we_support_page.htm”>Projects we support</a></li>
<li><a href=“file:///Users/tamborine/Downloads/resources_page”>Resources</a></li>
<li><a href=“file:///Users/tamborine/Downloads/prices_page”>Prices</a></li>
<li><a href=“file:///Users/tamborine/Downloads/faq_page.htm”>FAQ</a></li>
</ul>

When I open in browser only the first link (About) works, the others show 'File not Found' in browser

I've been searching forums and inspect element shows strange characters not present in html. I'm thinking encoding error? I am using TextEdit on mac. I tried playing with TextEdit settings, file format is plain text, encoding tried with UTF-8 and ASCII but no change.

I was previously on another computer using notepad and internet explorer when I made the first page (About) that is the only link that actually works now. Now I'm on mac, with TextEdit and Firefox.

Ideas? Thank you kindly


Solution

  • You have smart quotes in all but the first link. Those smart quotes are considered part of the URL which causes the browser to resolve your URLs incorrectly.

    Make sure that OS X isn't automatically converting your double quotes into smart double quotes as you type them. This can happen even while TextEdit is in plain text mode. Go to Edit > Substitutions in TextEdit and make sure Smart Quotes is unchecked. You can also disable this system-wide in System Preferences > Keyboard > Text > Use smart quotes and dashes. You can also opt for a fully-featured source code editor like Sublime Text, rather than using TextEdit.