PDA

View Full Version : [DHTML] Correct URL in frameset based site



molendijk
11-03-2007, 08:30 PM
1) CODE TITLE: Correct URL in frameset based site

2) AUTHOR NAME/NOTES: Arie Molendijk

3) DESCRIPTION: In frameset based sites, the URL in the address bar doesn't (normally) change on page transition. This might confuse the visitor and makes bookmarking of specific pages impossible. So it seems useful to have the name of the main frame's page (that the visitor is actually viewing) in one or more pages of the frameset based site. A click on the 'name' will then make it possible to bookmark the (specific) page.

4) URL TO CODE: http://molendijk.110mb.com/CorrectUrl/

or, ATTACHED BELOW (see #3 in guidelines below):

djr33
11-03-2007, 10:52 PM
Hm... doesn't work for me. (FF2, win)

Twey
11-03-2007, 11:16 PM
Nor Fx3. Does in Konqueror.

It's an interesting script, and (used with an absolute URL) can help to lessen one of the main accessibility problems with frames. Still doesn't rectify it completely, though: I'd recommend against using frames even with this script.

thetestingsite
11-04-2007, 12:42 AM
Actually, I think it does work in FF2; just not the way we expect it to. I checked it out in IE6+ and it works the same as in FF2. There is a little gray box at the top right corner of every frameset that holds the url of the page that is in the "main" frame. I personally think this is useless, but others may think differently.

djr33
11-04-2007, 12:59 AM
Haha. That is worthless. But I assume that's debugging, as Twey said it works in Konq.

molendijk
11-04-2007, 01:16 AM
Hello Daniel, Twey, Testingsite,

It works for me in FF 2.0.0.9, Moz. 1.7.5, Netscape 7.0, IE and Opera 9.23 (all win).

You should see a change in the gray box at the top right corner of every frame (of the frameset) at page transition (although almost imperceptible): page1.html when you visit page 1, page2.html when you visit page 2, etc.

I agree that it seems useless as it is. But combined with this thread (http://www.dynamicdrive.com/forums/showthread.php?t=25009), it might be of some help for people who want to use framesets without too many of the disadvantages.

Arie Molendijk.

Twey
11-04-2007, 01:07 AM
Ah! I had Javascript disabled. My apologies. Yes, it does work in Fx3.

molendijk
11-04-2007, 01:24 AM
Glad. Thanks for the information!

Arie Molendijk

molendijk
11-04-2007, 12:03 PM
Hello everyone,
Since there was a little debate on the usability of the script, I made some changes and clarifications. The idea behind it allows us to do things that would be hard to accomplish otherwise. It can be used, among other things, to bookmark specific pages of a frameset.

Arie Molendijk.

molendijk
11-04-2007, 03:25 PM
...It's an interesting script, and (used with an absolute URL) can help to lessen one of the main accessibility problems with frames. Still doesn't rectify it completely, though: I'd recommend against using frames even with this script.

Hello Twey,
I made some corrections. Are frames more acceptable to you now? (In this regard, also observe the link (to: particular use of framesets) in the left frame.

Arie M.

djr33
11-04-2007, 03:28 PM
Well, better. But now just link to that url, rather than still not updating the url.
We've always been able to get around frames, but having to manually find a url and bookmark that, etc., is just a pain.
Since you've setup direct urls that work, use 'em.
Plus, it seems like you can make it shorter than what actually shows up there; I'd suggest working on that, too.

molendijk
11-04-2007, 03:43 PM
Hello Daniel,
Thanks for the comment.
But what do you mean by 'But now just link to that url, rather than still not updating the url. ... We've always been able to get around frames, but having to manually find a url and bookmark that, etc., is just a pain.?'
You mean 'put the url in the address bar?'. And what is 'manually'? I don't do that in the script.
Apologies for my rather slow 'understanding capacities'.

Arie M.

djr33
11-04-2007, 03:50 PM
Well, the links still use a target attribute.

Instead of doing that, you should use the DIRECT link.

Remove this:
<base target="main">

Then it will change the url in the address bar and *should* still work to load in the frames.

But, then again, it will also reload everything, sorta defeating the point.

My inclination with this would be to try using a # url, like #page1, and then using Javascript based on that.

If I get a bit of time, I may try something like that.

It will both allow for the direct url to work and no reload.

The whole point of this script should be to find a way to update the URL in the address bar. That's the big advantage.

How would this work, including a nonJS fallback:
<a href="http://www.let.rug.nl/~molendyk/CorrectUrl/page3.html" onClick="main.location=this.href; return '#page3.html';">
Or
<a href="http://www.let.rug.nl/~molendyk/CorrectUrl/page3.html" onClick="main.location=this.href; top.location='#page3.html'; return false;">

I'm not quite sure that will work, but the idea should be clear.

molendijk
11-04-2007, 04:19 PM
Daniel,
Without the <base target="main">, your links load page 3 in the left frame.
I tried before to do things implying a change of the URL in the address bar, but that invariably caused a reload of 'everything'.

Thanks anyhow for your comment; I'll experiment with it.

Arie M.

djr33
11-04-2007, 04:39 PM
Well, more correctly, it should be
<base target="_top">

I'm thinking that the # method will work because that doesn't always cause a reload. Play with it.

molendijk
11-04-2007, 04:59 PM
I'll let you know as soon as I got something.
Thanks a lot in the meantime.

Ik heet Arie Molendijk
My name is Arie Molendijk
Ich heisse Arie Molendijk
Je m'appelle Arie Molendijk
Mihi nomen Arie Molendijk