-
Forcing Frames
Hi
I have a site at www.worldeasy.com which uses a left frame and top frame
We also have other pages.
www.forestsupporters.com
www.irishgunners.com
When a user logs into the above pages we want them to appear in the frames. However we also have a dropdown link on the worldeasy page.
So when a user uses this dropdown the frames are not forced confusing is'nt it
I have searched for some Java but nothing
Can anyone help
Cheers
Funkyirishman
-
please don't crosspost; it irritates most forum users
-
Forcing Frames Update
Hi
Sorry for the cross post
As an update
We have a site at www.worldeasy.com. I have set up a test page at www.worldeasy.com/test.htm which we want to load into our frameset
I used the below in the 'test' page
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from old browsers
if (top.location == self.location) {
self.location.replace("/?test.htm")
}
// End hiding script from old browsers -->
</SCRIPT>
I then used the below in our frameset (index.htm) page
<script language="javascript" type="text/javascript">
pageURL = "worldeasy.htm";
// script which check's if it's sent a URL, and parses this one
if (parent.document.URL) {
parentURL = parent.document.URL;
if (parentURL.indexOf('=') != -1) {
pageURL = parentURL.substring(parentURL.indexOf('=')+1,paren tURL.length);
}
</script>
The thing is that when I key in the webpsge www.worlldeasy.com\test.htm it opens up in the index page
What do I need to change so that the 'test' page opens up in the frameset ?
We are trying to do this with a few pages
Can anyone help or point me in the right direction ?
Cheers
Funkyirishman
-
Hi,
Just to comment on cjard's post - I think he's suggesting that you have posted a HTML / Javascript question (which is what it is), into a JAVA forum.
That aside, I'll answer it for you anyway !
I've done exactly this; and you are on the right lines, but only written half of the solution.
What you need to do is in each of your pages that are supposed to go into a frame, you need some Javascript at the top which detects the frame - if they are not in the frame that you want them to be in, redirect them to the actual frameset page.
This is what you are doing - BUT, you also need to pass a parameter of the page you have just come from, and your top level frameset page needs to have some Javascript that recognises that parameter and loads that page into the designated frame.
So, here is my code that I use for each of my pages:
<script>
var here=window.location.href
if (here == top.location.href) { top.location.href = 'frameset.htm&page="' +here+ '"' }
</script>
and then my frameset page looks like this:
<script>
function load_MainContent() {
var url=top.location.href
url = url.split("&page=")
if (url.length > 1) {
url[1] = unescape(url[1])
url = url[1].split('"')
url = url[1]
} else {
url="index.htm"
}
top.MainContentFrame.location.href = url
}
</script>
<frameset rows="125,*,35" frameborder="no" border="0" framespacing="0">
<frame name="MenuFrame" scrolling="NO" noresize src="menu.htm">
<frameset cols="197,*" frameborder="no" border="0" framespacing="0" onload="load_MainContent()">
<frame name="RelatedInfoFrame" scrolling="NO" noresize src="relatedinfo.htm">
<frame name="MainContentFrame" scrolling="AUTO" noresize src="javascript:''">
</frameset>
<frame name="BottomColourBarFrame" scrolling="NO" noresize src="bottombar.htm">
</frameset>
I used a nested frameset, but I guess you can see whats happening here.
The frameset that contains the frame where I want my content to go (the inner frameset) has an onload call to the Javascript function load_MainContent()
The frame that I actually want the content to go into (MainContentFrame) is initially set to have no content - IE. javascript:''
The load_MainContent() function then inspects the URL, looks for the &page= parameter, if there is one it sets the variable url to be that value, otherwise its set to index.htm
Then the location for the MainContentFrame is set to the value of url
Easy really
Hope this helps,
Nathan
PS. the phrase javascript:'' used above should not have a space between the a of java and the s of script - it should be all one word. I think that the logic behind this board detects the word and splits it to prevent people running malicious JS code in their postings - I do exactly the same thing on my user forum for the same reason !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks