2
   

Problem in seeking reframer script for orphaned pages

 
 
Reply Sat 26 Apr, 2003 11:49 pm
If a page that was intended to appear in a frameset is accessed outside of it's intended frameset, say from a hyperlink or search engine query result, then it may be referred to as an orphaned page. And I have found various reframer scripts that will reload orphaned pages into their intended framesets, as specified.

The only problem is, that I don't know how to also specify which of the frames in a specific frameset the orphaned page is to reload into.

All I want is a reframer script that clearly specifies, "Change the following into the URL of your frameset" and then "change the following into the [whatever] of the target frame" etc.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 2 • Views: 3,668 • Replies: 15
No top replies

 
Craven de Kere
 
  1  
Reply Sun 27 Apr, 2003 12:39 am
There are many ways to do that. One is to simply create a frameset fo each content page and in the content page use this simple script:


Code:<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (parent.location.href == self.location.href) {
window.location.href = 'frameset.html';
}
// End -->
</script>


"frameset.html" should be replaced with the frame that would load that content.

But that's not the best way. Here is the best way:

Here is code for a three frame frameset. The default pages loaded in the frame are frame1.html, frame2.html and frame3.html

You can change that in the array in the code below.

Let's call the frames page "frameset.html"
Code:<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";

var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<FRAMESET COLS="200, *">',
'<FRAME SRC="', ar0, '" NAME="leftcolumn">',
'<FRAMESET ROWS="100, *">',
'<FRAME SRC="', ar1, '" NAME="toprow">',
'<FRAME SRC="', ar2, '" NAME="bottomrow">',
'</FRAMESET>',
'</FRAMESET>'
);

// -->
</SCRIPT>
</HTML>



In that code the part that needs changing (other than the frame sizes etc) is:

Quote:
var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";




Now each of the pages to be loaded in the frame should have this code:

Code:<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--

if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";

// -->
</SCRIPT>
</HEAD>
<BODY>
text
</BODY>
</HTML>



What needs to be changed for that code is:

Quote:
if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";


Orange = frameset page
red = orphan page
blue = frame to load in (0,1 and 2)

In the example code 0 = left frame, 1 = top frame and 2 = the main frame



That method will work for as many pages as you would like.

Let me know if you need any more help with this.
0 Replies
 
AaronAgassi
 
  1  
Reply Sun 27 Apr, 2003 12:55 am
Thanks, this is EXACTLY what I did NOT want. I can't make head or tail of it.

I have found reframer scripts that at least are clear enough about "put this in this in the head.body of the frameset, and that in the head/body of the orphaned page" (but not the specifics that I asked about in my initial post). Yours doesn't even do that much!

I don't understand and I don't want to know!

Please stop trying to educate me and kindly just direct me to what I do actually need.
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 27 Apr, 2003 12:59 am
That code does exactly what you specified. If you tell me what you don't understand i will explain it.

If you tell me more about how you want to use it, I will make it for you and send you the files as well as the instructions on where to place additional code in new pages you create.
0 Replies
 
AaronAgassi
 
  1  
Reply Sun 27 Apr, 2003 01:19 am
I just want blocks of code that begin with:
"Put this in the head/body of the orphaned page" and "put this in the head/body of the frameset" and include "replace the following with the relative URL of the frameset" and, lastly and which I have not found, "replace the following with the name(?) etc. of the target frame that the orphan page is to reload in" (because I use multiframe framesets, and different orphan pages are each intended to go into different frames of the same frameset.).

That's all!
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 27 Apr, 2003 01:30 am
Frameset page = "frameset.html"

Save the following code as frameset.html, just copy it all and save it as a page. If you want to insert the head portion then the body portion feel free to do so but you need both.
Code:<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";

var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<FRAMESET COLS="200, *">',
'<FRAME SRC="', ar0, '" NAME="leftcolumn">',
'<FRAMESET ROWS="100, *">',
'<FRAME SRC="', ar1, '" NAME="toprow">',
'<FRAME SRC="', ar2, '" NAME="bottomrow">',
'</FRAMESET>',
'</FRAMESET>'
);

// -->
</SCRIPT>
</HTML>



In that page the part that needs changing (other than the frame sizes etc) is:

Quote:
var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";


Change the red parts to the page names you want to have load in the frame as default.


This concludes the frameset code.
--------------------------

Insert the following into the head portion of any page that loads in the frameset you made above.



Code: <SCRIPT LANGUAGE="JavaScript">
<!--

if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";

// -->
</SCRIPT>



What needs to be changed for that code is:

Quote:
if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";


Orange = frameset page (replace this with the name of the frameset page.
red = orphan page url replace this with the orphan page's name.
blue = frame to load in (0,1 and 2) This is the part you said you didn't see. The target frames are referenced by numbers (not the frame name) 0 = left frame, 1 = top frame and 2 = the main frame
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 27 Apr, 2003 01:35 am
If you need any more help you will have to be less rude about it. I have explained the code and am happy to explain it further. i am not willing, however, to endure rude comments while trying to help you.
0 Replies
 
AaronAgassi
 
  1  
Reply Sun 27 Apr, 2003 02:23 am
Sorry, I did not mean to be rude, only unambiguous.

What I want is for a given page, the so called orphaned page, when accessed by itself (as from a link or search engine query result), to reload into a specific frameset instead. (The added code to do this is what is sometimes called a reframer script.) But I need to also tell the orphaned page which frame of the specified frameset to reload into.

Also, blocks of code would be least ambiguous if they begin with, for example:
// Copy and paste the following into the [head/body/between...] of the [frameset/orphaned page].//
-As well as indication of the variables to be changed to target, in the orphaned page, a) the relative URL of the intended frameset and b) the name (?) of the frame that the orphaned page is to occupy, overriding the default just for that frame, but typically leaving alone the defaults for the other frames in the target frameset.

This would NOT be specified in the frameset itself, as there will be a plethora of orphaned pages needing, when accessed, to reload, by themselves, into the same frameset. Different pages will need to target different frames in the same frameset, but some may even target the same frame in any given target frameset. That is why each orphaned page must carry for itself all of it's own complete targeting information, both intended frameset and intended frame, even if the frameset must have inserted it's own block of code to receive the variables transferred from each orphaned page as it reloads itself.

Even the clearest reframer scripts I've found fail to indicate clearly how to specify, that is, what to change in the code to be inserted in each orphaned page, which specific frame in the frameset to target.
0 Replies
 
Monger
 
  1  
Reply Sun 27 Apr, 2003 04:59 am
AaronAgassi, this is an excellent web design topic, and something I've been wanting to do myself for a while now. Thanks Craven for the instructions. Aaron, Craven's code does exactly what you're asking about. Personally, I think Craven explained it quite well.
0 Replies
 
Monger
 
  1  
Reply Sun 27 Apr, 2003 07:06 am
AaronAgassi wrote:
Even the clearest reframer scripts I've found fail to indicate clearly how to specify, that is, what to change in the code to be inserted in each orphaned page,
Craven de Kere wrote:
What needs to be changed for that code is:

Quote:
if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";


Orange = frameset page (replace this with the name of the frameset page.)
red = orphan page url (replace this with the orphan page's name.)


AaronAgassi wrote:
..and which specific frame in the frameset to target.
Craven de Kere wrote:
blue = frame to load in (0,1 and 2) This is the part you said you didn't see. The target frames are referenced by numbers (not the frame name) 0 = left frame, 1 = top frame and 2 = the main frame


Craven's code segment should be read with his entire post, but those are the answers to your questions I think.
0 Replies
 
AaronAgassi
 
  1  
Reply Sun 27 Apr, 2003 10:56 am
No, the instructions are still not clear to a dummy like me. To me, it still looks like the orphan page parameters are being specified in the code block for insertion into the frameset! Not each different orphan page.

I also don't quite understand the part specifying the target frame, as it works indirectly, the numbers then referencing the parameters that are actually replaced.

The insertion and alteration instructions are simply not explicit enough. They are not, themselves, algorithmic enough for a dyslexic like me!

Indeed, if the instructions where to paste each code block do not actually appear at the as remarks at the top of each code block, and the explicit paramiter substetutions instructions do not appear as remarks in the code right next to the paramiters in question, I will remain hopelessly confused!

I.e:
// Change the following paramiter to _______ of your...

No, really...
0 Replies
 
AaronAgassi
 
  1  
Reply Sun 27 Apr, 2003 05:37 pm
Thanks for the code help, but if it isn't parced with remarks in the standard manner for the free scripts online that I have been using, I will have difficuilty following it. Dyslexia, as I said. No kidding. I can't read it! My eyes just swim. I lack the RAM, so to speak, I have a problem with short term memory, "like writing on water" as my doctor put it.
0 Replies
 
Craven de Kere
 
  1  
Reply Fri 2 May, 2003 02:52 pm
Aaron,

I spent lots of time thinking about it and I simply do not think I am capable of making it any clearer.

It's not a standard script. It needs to work on multiple pages seamlessly. Because of that it has several variables.

I can do it for you if you like, but I don't think I can explain it any better.
0 Replies
 
ICARVZ
 
  1  
Reply Thu 5 Feb, 2004 10:04 am
Reloading into Framesets
My personal preference would be to use window.location.href rather than naming the page in the header, and to put the content page code in an external file.

adding this to all of the content pages within the site:
<SCRIPT LANGUAGE="JavaScript" SRC="loader.js"></SCRIPT>

and the following inside the file "loader.js":
if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.htm?"+window.location.href+"&2";


the original frameset remains the same.
0 Replies
 
Mxyptlk
 
  1  
Reply Wed 30 Mar, 2005 05:02 pm
Please, urgent help needed, will pay
Hi,

The script you have here is the same script that I am using. I got a copy of this basically exact script posted elsewhere. It works great and so I started a large project based on depending on it. Then I found myself in deep doo doo. I found I needed to send a URL with a querystring attached. With this javascript, the querystring disappears. So somehow, I need to pass a value/ querystring to the orphan who then becomes the child without losing it. I am on a windows platform and I am using ASP pages.

I am really desparate. I am willing to pay for this help. I've tried and tried and searched and searched and I cannot get this done so I can move on with this project. It's been 4 days and I need to solve this today. I tried to send you a PM but I am brand new and it will not let me do that.

I need to show you the minor difference in the script I am using, from the one you posted. But I do not want to clog up this message. You know I must be desperate to put my email on here. You can respond to me here or at dennis @ connexions . net . (note that this particular address of mine is 10 years old and has tight spam blocking and it is hard for me to keep tabs on whether it has good mail in the junk box, with a thousand spams a day. If you email me, please also post here.

Sorry for be running on so much, lack of sleep and high anxiety over this project coupled with a sinus infection.

In case this will simplify things. My queries need to end up attached to the src = AR2 . This is the one main issue, and as explained, this is very pivotol to the entire project.

Thanks,
Dennis (Mxyptlk)

Craven de Kere wrote:
Frameset page = "frameset.html"

Save the following code as frameset.html, just copy it all and save it as a page. If you want to insert the head portion then the body portion feel free to do so but you need both.
Code:<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";

var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<FRAMESET COLS="200, *">',
'<FRAME SRC="', ar0, '" NAME="leftcolumn">',
'<FRAMESET ROWS="100, *">',
'<FRAME SRC="', ar1, '" NAME="toprow">',
'<FRAME SRC="', ar2, '" NAME="bottomrow">',
'</FRAMESET>',
'</FRAMESET>'
);

// -->
</SCRIPT>
</HTML>



In that page the part that needs changing (other than the frame sizes etc) is:

Quote:
var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";


Change the red parts to the page names you want to have load in the frame as default.


This concludes the frameset code.
--------------------------

Insert the following into the head portion of any page that loads in the frameset you made above.



Code: <SCRIPT LANGUAGE="JavaScript">
<!--

if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";

// -->
</SCRIPT>



What needs to be changed for that code is:

Quote:
if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";


Orange = frameset page (replace this with the name of the frameset page.
red = orphan page url replace this with the orphan page's name.
blue = frame to load in (0,1 and 2) This is the part you said you didn't see. The target frames are referenced by numbers (not the frame name) 0 = left frame, 1 = top frame and 2 = the main frame
0 Replies
 
Mxyptlk
 
  1  
Reply Wed 30 Mar, 2005 05:10 pm
Posting script with the difference mine uses.
Hi,

Here is the version of the script I am using. I am so thankful that someone posted this. But now I am in a mess. Note that I can use ASP to resolve the querystring. And then use <% =Request.QueryString("RegType") %> .. Unfortunately I have no knowledge of javasript beyond what I can deduce and apply from now learning ASP/ADO.

<SCRIPT LANGUAGE="JavaScript">
<!--

var ar0 = "top.asp";
var ar1 = "side.asp";
var ar2 = "welcome.asp";


var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<frameset framespacing="0" border="0" frameborder="0" rows="152,*">',
'<frame name="toprow" scrolling="no" noresize target="maincontent" src="', ar0, '" marginwidth="0" marginheight="0">',
'<frameset cols="181, *">',
'<frame name="leftcolumn" target="maincontent" src="', ar1, '" marginwidth="0" marginheight="0" scrolling="auto" noresize>',
'<frame name="maincontent" src="', ar2, '" marginwidth="0" marginheight="0" scrolling="auto">',
'</FRAMESET>',
'</FRAMESET>'
);

// -->
</SCRIPT>





ORPHANED PAGE SCRIPT
<%@ Language="VBscript" %>
<% RegType = (Request.QueryString("RegType"))
<SCRIPT LANGUAGE="JavaScript">
<!--
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

if (top.location.href.indexOf("default.asp") == -1)
top.location.href = "default.asp?" + sPage + "&2";

// -->
</SCRIPT>

Thanks,
Dennis (Mxyptlk)
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Problem in seeking reframer script for orphaned pages
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 11/03/2024 at 05:21:41