PDA

View Full Version : Named Anchors not working


Dayne
03-13-2011, 10:33 PM
I can't seem to make named anchors work in Dreamweaver CS5. I have placed and named the anchor at the right place and used the #anchor_name in the link, but when I click the link- I get the correct page and position, but all the formatting and art is removed from the page. Very ugly results.

I have used this method before, maybe I am forgetting a step. I would show you an example, but I don't want to place a named anchor on my site (even for a short time) until it works correctly.

Thanks for your response.:confused:

DWcourse
03-14-2011, 01:53 AM
Adding an anchor tag shouldn't have any effect on the display of the page.

Are you previewing the page in a browser and then clicking the link to the anchor?

If so, I suspect the page is reloading in your browser and then failing to connect to your images and css. That's because DW's Preview in Broswer… function makes adjustments to those links so that they work correctly on your local computer. Those adjustments only apply to when the page is previewed directly from DW. If it's reloaded those links might not display correctly.

I'd bet everything will work alright once you upload the file. So, why not rename the file on the server and upload the modified file with the anchor. If things look OK online, delete the old file on the server. If not, delete the new file on the server and restore the file name of the old one.

Either way, let us know how it works out.

Dayne
03-15-2011, 11:17 PM
I went ahead and published the page with the named anchor. All the files and links are in place in both versions.

This is the URL without the anchor (This is the way it should look):
http://allergycomfortzone.com/skin-allergies

This is the URL with anchor:
http://allergycomfortzone.com/skin-allergies/#textileAllergies

What I'm seeing is really, really ugly with the anchor!

Thanks for your help.

DWcourse
03-16-2011, 12:05 AM
That's not how you link to an anchor. Try this:

http://allergycomfortzone.com/skin-allergies#textileAllergies

There should be no slash after the skin-allergies

DWcourse
03-16-2011, 12:13 AM
Although you do have something very odd happening on your site.

http://allergycomfortzone.com/skin-allergies is the same as http://allergycomfortzone.com/skin-allergies.html

but http://allergycomfortzone.com/skin-allergies/ is broken (probably because all your links are document relative).

BTW http://allergycomfortzone.com/skin-allergies/index.html is the same page as http://allergycomfortzone.com/skin-allergies/index is the same page as http://allergycomfortzone.com/skin-allergies/

I suspect a bad 301 redirect in your .htaccess file or a misconfiguration on the server.

Dayne
03-16-2011, 03:54 PM
Wow, thanks for all the help, I really didn't know about NOT using the slash in the URL, so that's easy to fix.

Now I'm not sure how to proceed with the other problems. I didn't know that there was a difference between using the .html and not ( either one used in my broswer seems to take me to the right page). I guess you can see where my huge gaps in HTML education are.

I have never messed with a .htaccess file. If I remember rightly, I see that file on the Go Daddy server when I put or get files. It doesn't reside in my local site? I know I do need to knuckle down and learn basis HTML if I want to go further with Dreamweaver.

Thanks

Dayne
03-16-2011, 04:02 PM
I just tried that corrected link (http://allergycomfortzone.com/skin-allergies.html#textileAllergies or http://allergycomfortzone.com/skin-allergiesl#textileAllergies) and it doesn't take me to the named anchor with or without the .html. It should take us to the blog on that page: "Textile Allergies- Are you allergic to your clothes". Maybe I also have the named anchor set up wrong.

Dayne
03-16-2011, 04:09 PM
I just went to your tutorial site. I live in St. Louis also. Small world.