PDA

View Full Version : Linking to an Anchor on another page


PD_Golfer
05-28-2013, 05:52 PM
I have a link on a page that I would like to open on another page. I've created an Anchor on the other page but cannot figure out how to code the link so that it will open on the other page.
I have a link (News/Calendars/2012/Master Calendar.htm). I want this link to open on the other page (Calenar Test) at the anchor location named Calendar.

gentleone
05-28-2013, 11:31 PM
If I read the title of your thread, than I think okay that's easy... I know what you want, but if I read the rest, than you're confusing me :confused:

This is the answer to your title which will open the page Master Calendar.htm with the content of the anchor target 'Calendar' at the top of the browser window (viewport):
<a href="News/Calendars/2012/Master Calendar.htm#Calendar">link</a>Small tip: better to avoid spaces in links (URL's). It looks messy in the address bar with this '20%' indicating the space and FTP software might have also issues with it while uploading your page. Just use a dash to separate 'Master' and 'Calendar'.
<a href="News/Calendars/2012/Master-Calendar.htm#Calendar">link</a>

PD_Golfer
05-29-2013, 12:10 AM
Thanks for the response and sorry for the confusion.

Essentially I have a page that has a link for a calendar. The link is News/Calendars/2012/Master Calendar.htm. I want that to open on another page called "Calendar Test" at an anchor location named Calendar.

I saw your response but am confused as it shows the link with the Anchor Name attached. My confusion is how this link gets to the page called Calendar Test.

Hope this is a bit clearer and thanks again.

edbr
05-29-2013, 01:42 AM
in simple terms its a link + #anchorname.

so it is as gentleone said . i would second his caution on naming and add a hyphen or underscore, dont use spaces in page names

PD_Golfer
05-29-2013, 02:30 AM
I put in the link plus the anchor name. The page opens but not in the intended page (Calendar Test).

edbr
05-29-2013, 05:03 AM
then the path may be wrong
Is this live? if so whats rhe URL?

PD_Golfer
05-29-2013, 05:15 AM
The site is not on-line yet. Hopefully by the first of next week.
I think the path is correct since the actual calendar and the Calendar Test.html file are in the same directory and the Calendar itself opens.

edbr
05-29-2013, 05:21 AM
so the link fails when you add the anchor parameter??
this works?
News/Calendars/2012/Master Calendar.htm
then
News/Calendars/2012/Master Calendar.htm#Calendar doesnt?

gentleone
05-29-2013, 10:09 AM
Okay... this part is confusing me :)The link is News/Calendars/2012/Master Calendar.htm. I want that to open on another page called "Calendar Test" at an anchor location named Calendar.

If you click on a link that goes to the page News/Calendars/2012/Master-Calendar.htm it will open News/Calendars/2012/Master-Calendar.htm not a page called Calendar-Test.htm.
My confusion is how this link gets to the page called Calendar Test.
You can't open that page if you link to a page Master-Calendar.htm. Well... not with the default behavior of clicking on links. If you want to open Calendar-Test.htm than you need to link to that page properly like so for instance: News/Calendars/2012/Calendar-Test.htm

d a v e
05-29-2013, 11:08 AM
also to avoid confusion - better not to use either upper case letters or spaces in filenames: use-hyphens-or_underscores ;)

Corrosive
05-29-2013, 12:24 PM
also to avoid confusion - better not to use either upper case letters or spaces in filenames: use-hyphens-or_underscores ;)

Yes, but be aware of the differences between underscores and hyphens with Google. As Matt Cutts says "We still join on the underscore and separate on the dash".

gentleone
05-29-2013, 02:18 PM
also to avoid confusion - better not to use either upper case letters or spaces in filenames: use-hyphens-or_underscores ;)
Yeah, I wanted to mention the uppercases as well, They make things indeed more confusing for the visitors while as far as I can tell all the browser interpret them as lowercase letters anyways.

d a v e
05-29-2013, 05:35 PM
good reminder Corrosive.

isn't it more a matter of the server and it being case sensitive - was it windows servers aren't but linux servers are? or something. anyway i never use capitals and spaces to avoid any of those problems :)

PD_Golfer
05-30-2013, 06:25 PM
Thanks for all the replies.
To clarify (I hope) When I link to News/Calendars/2012/Master Calendar.htm the Calendar opens in its own page. When I link to News/Calendars/2012/Master Calendar.htm#Calendar the calendar also opens in its own page.
My goal was to have it open on a template created page called Calendar Test.
I'm beginning to think that this might not be possible.
Again thank to you guys for the help.

edbr
05-31-2013, 01:07 AM
no thats not what named anchors do, just link to where you want it to go