Frame-unbusting trick?

As part of a woefully-underfunded internal project my wife has
produced a company intranet site, and it is working very well…
considering the limitations she had to deal with.

It is just a set of flat files, edited using Adobe Contribute by
certain people in different departments, and she manages the
navigation. Because of this split management it is built using frames.

What people need to do now is be able to make links to pages so they
can be emailed around as necessary. But, of course, because they
normally live within frames, those appear on their own when someone
uses a page-specific link.

How self-contained and hands-off could a JavaScript be for
‘unbusting’ a page if opened without the parent frame so that it
opens in the correct frameset? I’m hoping to be able to find/work out
something that could be slotted into every page with little or no
section-by-section customising, that would force orphan pages to open
in the correct frameset.

One step further, would it be possible, or perhaps help, to have
something people can click to produce an emailable link to the page
in question?

It is run from a basic Windows server with no PHP available. But I
think it might be possible to have a generic frameset file reference,
as each frameset file and set of department pages is within its own
folder, and the frameset is called index.html. (For example, in the
IT department’s section there’s a frameset, the standard IT
navigation page with the IT dept colour and link hilight, and the
various ‘main frame’ pages.)

Sorry everyone - I know this is not exactly a Freeway question -
other than that’s how the site was initially built. :slight_smile:

Any suggestions would be great!

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 23/7/08 (at 09:47 +0100) Keith Martin said:

How self-contained and hands-off could a JavaScript be for
‘unbusting’ a page if opened without the parent frame so that it
opens in the correct frameset?

I’m part-way there I think. But this just opens the frameset with its
standard default set of pages rather than using the page that someone
linked to:

 if (parent.location.href == self.location.href){
 window.location.href = 'index.html'
 }

So maybe I’m not part-way there at all… :slight_smile:

Oh, if only they’d install PHP on that *@%! server! Not that I know a
PHP-based solution right now, but it would open up so many more
posibilities.

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

HI Keith I came across this some time ago and it has an example frame that jumps back to a frame-set if opened in isolation…
This may work in your scenario

this is the example:

http://www.htmlgoodies.com/legacy/tutorials/frames/no_go_frame_page.html

and this was the article

http://www.htmlgoodies.com/tutorials/frames/article.php/3479291#examples

max


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 23/7/08 (at 06:03 -0400) max said:

HI Keith I came across this some time ago and it has an example
frame that jumps back to a frame-set if opened in isolation…

Thanks Max - the big problem is that the page someone wants to link
to isn’t necessarily one that’s set to load automatically when the
frameset is opened. I guess one solution could be for the link to
pass a variable and the frameset to use that as the source for one of
the frames. But there’s currently no form-processing language on the
server that I know of. Hmm… :frowning:

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes it looks like it’s a hmm and scratch the bonse time, if I find or think of anything I will let you know

max


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Keith,

I thought there was an old action for this “Frameset Loader”

So when someone lands on a frameset page alone, it forces the correct frameset to be loaded.

David

On 23 Jul 2008, at 09:47, Keith Martin wrote:

How self-contained and hands-off could a JavaScript be for

‘unbusting’ a page if opened without the parent frame so that it

opens in the correct frameset? I’m hoping to be able to find/work out

something that could be slotted into every page with little or no

section-by-section customising, that would force orphan pages to open

in the correct frameset.

David Owen
Freeway Friendly Web hosting and Domains ::
(Test Drive a web hosting account for Free)

http://www.ineedwebhosting.co.uk

http://www.printlineadvertising.co.uk/freeway

…for example this page of ours, is in a frameset,

http;//www.printlineadvertising.co.uk/colour_leaflets.html

but when linked to, it loads the correct frameset around it.

Is this what you’re looking for?

David

On 23 Jul 2008, at 09:47, Keith Martin wrote:

How self-contained and hands-off could a JavaScript be for

‘unbusting’ a page if opened without the parent frame so that it

opens in the correct frameset?

David Owen
Freeway Friendly Web hosting and Domains ::
(Test Drive a web hosting account for Free)

http://www.ineedwebhosting.co.uk

http://www.printlineadvertising.co.uk/freeway

If these pages always need to load into the same frameset, then you could build the technique into the frameset using either JS or a server language like PHP. Here’s the basic technique:

<script type="text/javascript">
//in the orphan page
if(self.top == self){
    window.location.href = 'your_clever_page.php?child=' + encodeURIComponent(self.location.href);
}
</script>

Then on your clever page, you would get the querystring and load the appropriate page.

<?php
$child = 'your_default_page.html';
if(isset($_GET['child'])){
    $child = trim(strip_tags($_GET['child']));
}
?>
...later on, inside your HTML
...frame src="<?= $child ?>"...

You can also do this completely in JavaScript, if you don’t want to change the frameset page to PHP for some reason. Let me know and I’ll dig it out, it’s more complex on the gathering variables side, but then manipulating the frame src is similarly trivial to the PHP example.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry that link should have been…

http://www.printlineadvertising.co.uk/colour-leaflets.html

David

On 23 Jul 2008, at 12:58, David Owen wrote:

…for example this page of ours, is in a frameset,

http;//www.printlineadvertising.co.uk/colour_leaflets.html

but when linked to, it loads the correct frameset around it.

David Owen
Freeway Friendly Web hosting and Domains ::
(Test Drive a web hosting account for Free)

http://www.ineedwebhosting.co.uk

http://www.printlineadvertising.co.uk/freeway

Sometime around 23/7/08 (at 12:44 +0100) David Owen said:

I thought there was an old action for this “Frameset Loader”

So when someone lands on a frameset page alone, it forces the
correct frameset to be loaded.

Hi David,

The trouble is, the specified frameset simply loads its predefined
set of pages, which doesn’t necessarily include the original page.
That’s the big issue.

Curiously, this does seem to be what’s happening in your example,
but the Frameset Loader action doesn’t seem to allow for this.

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 23/7/08 (at 08:50 -0400) waltd said:

…Some useful stuff. As usual. :slight_smile:

You can also do this completely in JavaScript, if you don’t want to
change the frameset page to PHP for some reason.

Yep, I’m afraid there is ‘some reason’: PHP isn’t available on the
internal server, and it is highly unlikely that it’ll be added. The
guy that would set that up is apparently technically unadventurous
and rather unenthused by the idea of figuring it out. Even though I
don’t think it would be particularly complex. Hey-ho!

If you do have some purely JS-based thing handy I’d love to see it.
But if not, Bridget says please don’t worry about it!

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I used two action on this “Frame Autoload” on the frameset and “Frameset loader” on any page wanting links to it to re-load the correct page in the frameset.

On 23 Jul 2008, at 14:11, Keith Martin wrote:

The trouble is, the specified frameset simply loads its predefined

set of pages, which doesn’t necessarily include the original page.

That’s the big issue.

Curiously, this does seem to be what’s happening in your example,

but the Frameset Loader action doesn’t seem to allow for this.

David Owen
Freeway Friendly Web hosting and Domains ::
(Test Drive a web hosting account for Free)

http://www.ineedwebhosting.co.uk

http://www.printlineadvertising.co.uk/freeway

Okay, then the (untested) JS way to do this in the frameset page would be this:

<script type="text/javascript" charset="utf-8">
	if(self.search && self.search.indexOf('child=') > -1){
		var end = (self.search.indexOf('&') > self.search.indexOf('child=')) ? (self.search.indexOf('&') - (self.search.indexOf('child=') + 6)) -  : 256;
		var child = self.search.substr( (self.search.indexOf('child=') + 6) , end);
		child = decodeURIComponent(child);
		//in a vanilla Freeway frameset, the main frame is called 'main', adjust for your implementation
		main.src = child;
	}
</script>

Put this code as high up in the HEAD as you can, After < head > should do the trick.

If this doesn’t work, then there’s a way to invoke it using an onload, but that will take some testing to figure out. The basic variable-getting should work fine, though.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry, typo in this line:

    var end = (self.search.indexOf('&') > self.search.indexOf('child=')) ? (self.search.indexOf('&') - (self.search.indexOf('child=') + 6)) -  : 256;

Should be:

    var end = (self.search.indexOf('&') > self.search.indexOf('child=')) ? (self.search.indexOf('&') - (self.search.indexOf('child=') + 6)) : 256;

freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just tested something, and found a glaring error in my JS above. Everywhere you see self.search, substitute self.location.search. That will work, while self.search will always return undefined.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 23/7/08 (at 10:47 -0400) waltd said:

Just tested something, and found a glaring error in my JS above.

:slight_smile:

Thanks Walter! I’ll give that a go a bit later. Yesterday got
swallowed up by my attempts to downgrade my iPhone back to 1.1.4 in
order to use a particular third-party app. (The attempt was abortive,
but I did eventually manage to un-brick it and restore it to 2.0.)

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options