Links to Named Anchors
Tinkersdamn
Registered Users Posts: 18 Big grins
Links to named anchors inside of resources at SmugMug do not work properly.
The URI's appear to be mangled by SmugMug. The result is that, in situtations where the to/from link anchors are on different pages, the page returned is always positioned at the top, instead of at the location in the target page specified by the fragement identifier.
For example; href="/gallery/foo#bar" should return a resource "foo" and preserve the fragment identifier "#bar" in the URI so that the browser can position its view to the proper point inside of the resource.)
This works properly in SmugMug only when both the 'to' and 'from' anchors are in the same page (it still mangles the URI) but not if the pages are different.
Details, examples and plenty of discussion of this behavior is here at this thread.
This is a link to the w3c specification which describes how fragment identifiers should work. The link itself is also an excellent example of the proper behavior.
I've managed to use a less than perfect workaround so this is not urgent. Just wanted to get it logged as a bug. Thanks.
The URI's appear to be mangled by SmugMug. The result is that, in situtations where the to/from link anchors are on different pages, the page returned is always positioned at the top, instead of at the location in the target page specified by the fragement identifier.
For example; href="/gallery/foo#bar" should return a resource "foo" and preserve the fragment identifier "#bar" in the URI so that the browser can position its view to the proper point inside of the resource.)
This works properly in SmugMug only when both the 'to' and 'from' anchors are in the same page (it still mangles the URI) but not if the pages are different.
Details, examples and plenty of discussion of this behavior is here at this thread.
This is a link to the w3c specification which describes how fragment identifiers should work. The link itself is also an excellent example of the proper behavior.
I've managed to use a less than perfect workaround so this is not urgent. Just wanted to get it logged as a bug. Thanks.
0
Comments
However, if you are referring to a non-gallery page, then you are probably out of luck
The site reference is above. But... mine is a practical workaround not a technical one. It is simply to point the user to the page with the content and place an unordered list at the top of the page that can be used to navigate to the intended target anchor. Since things seem to work properly inside of a page this is a workable solution albeit more complicated for users than it should be.
The code that parses the URI inside SmugMug needs to be changed to preserve the fragment identifier '#foo' in all cases and tack it back onto the URI that is returned to the browser. This is beyond my mere mortal capabilities.
I can only speculate that the original design intended to use the '#' correctly, and the fragment identifiers pointed to photos inside of gallery pages and that these locations were marked with anchors. But then someone got creative and bent the design so that the '#' was assumed to point to a pre-ordained set of anticipated objects which of course left the W3C standards in the dust. Just a hunch...
Your problem has actually been my problem as well, since I would love to build a page using the fragment identifier without invoking javascript. What I found out is that the browser does not send the fragment identifier or hash tag to the server when it requests a web page. The browser only sends the important part of the URL - but keeps that hash tag for itself to use. (Some browsers MAY send the fragment identifier - but certainly not the majority of them).
The only work around I know is to have a little bit of javascript at the top of your page that looks for location.hash and reloads it if it finds anything (after the page loads).
I hope that makes sense, if not just let me know and I can try again
http://www.ravensphotography.smugmug.com/gallery/8285063_F7JU6#PORTRAITS
Homepage • Popular
JFriend's javascript customizations • Secrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
I think the problem then is that the URI returned to the browser is NOT the one that is sent to the server. It comes back different in most cases.
Here is what I see going on -
Assume - gallery URI is \gallery\n-k
Assume - gallery page contains an anchor with id="foo" (or name="foo") somewhere on the page,
Then -
CASE #1: STARTING POINT IS THE GALLERY PAGE (\gallery\n-k)
You click on an anchor containing an href=#foo you will be taken to the proper position inside the page (the spot containing the anchor with id="foo").
This now makes sense to me based on what you said about browser behavior. The browser already has the identified resource loaded so it just jumps to the anchor in the page it has cached and does not request anything from the server.
CASE #2: YOU ARE ON ANY OTHER PAGE
Your browser requests the URI -
\gallery\n-k#foo
the URI comes back mangled as -
\gallery\n-k\1\foo
but the same page gets returned. (i.e. same as if you had gone to \gallery\xxx-yyy)
And of course once it is loaded, since it is the same page and the browser now has it loaded, you can now get to the right place from there if you try \gallery\n-k\1\foo#foo.
But if you are coming from anywhere else then -
a link to ... takes you to ... (top of page)
\gallery\n-k#foo --> \gallery\n-k\1\foo
\gallery\n-k\1#foo --> \gallery\n-k\1\foo
\gallery\n-k\1\foo#foo --> \gallery\n-k\1\foo
I'm a bit surprised that the last one above does not work since the URI returned is the same as the one requested. I think the browser (I'm using FF 3.5.2) must not trust what is returned to be complete even in this case.
I'm not very experienced with how the browser does page processing but could it be that in the last case it does not look for the anchor because it invalidates the resource after it runs javascript on the page it just loaded? I have JS (Top JS) in this page to suppress links on the photos.
[There is also "Bottom" JS to make the home page behave like a .gallery page]