FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

A little query on frames...

 


Yazz
Hey, I'm wondering if anyone around here can help me with a question. It's not exactly a problem, but it'd be very nice if i could manage it.

You see, on my website, I use frames to display my content in a 550x550 pixel square. It's designed after the main idea behind the site (Mini-Toonz). What some people have asked me is if I could offer them a version of my site without frames, so that people with large screen resolutions wouldn't have to be bugged by such a tiny viewing area. Now, I've managed to make my site seamlessly perfect in both frames and without frames, so my only trouble is offering a way for people to see my site without frames. I can do this by offering a link on the base page (which doesn't change no matter where you go in my site), but the link only points to the Home page. So let's say you're in the Art section and you want to leave the frames, you click the link and it sends you back Home. What I'd like to know, is if there's any way to code a link so that all it does is remove certain frames, leaving the frame I want to keep. Then the viewer would not be sent back to the Home page and could continue viewing my site from where they left off, in a much more spread out view.

Thanks if you can help!
tkGER
if you have this link pasted in every page, it would be easy: you just point the link towards the non-frame version of the current site.
If the link is on another frame, you can access the contents frame with javascript, and extract the location.href or something similar. The code isnt difficult at all its just something like:
Code:
window.frames[1].location.href

Hope this helps
Yazz
Oh! Thanks! I'm not sure I know how to apply it, however... Could you show me?

My site is in my sig, but just to make sure:

http://yazzeh.frih.net/

The link to remove frames is on the bottom right.

Thanks if you help me out with this!
kevinalle
ok,
if you wanted to build the link, the link should look like:
Code:
<a href="javascript:stripframes()">link txt</a>

and then you should have a javascript in the head section that would look like:
Code:
<script language="javascript">
function stripframes(){
parent.location.href=window.frames[1].location.href;
}
</script>

And if the content of the frme where a different page as the content of the non-frame, you should try to build the new url with the string window.frames[1].location.href.
tkGER
kevinalle wrote:
ok,
if you wanted to build the link, the link should look like:
Code:
<a href="javascript:stripframes()">link txt</a>

and then you should have a javascript in the head section that would look like:
Code:
<script language="javascript">
function stripframes(){
parent.location.href=window.frames[1].location.href;
}
</script>

And if the content of the frme where a different page as the content of the non-frame, you should try to build the new url with the string window.frames[1].location.href.


Ok, thats the code. Just, instead of window.frames[1], it should be window.frames[0] or window.frames['index1.html'] (thats a strange name for a frame). so, the code again:

In head:
Code:
<script language="JavaScript">
function stripframes(){
parent.location.href=window.frames[0].location.href;
}
</script>


In body:
Code:
<a href="javascript:stripframes()">link text</a>
Yazz
Awesome, thanks guys!

I'll try it out tomorrow, I need some sleep. I'll let you know how it goes.
Yazz
Alas! Success!

Haha, thanks guys, you were a really big help! I had to clean up the frames on my site, majorly. I was using two pages of frames, one for the inline and the other for the header and bottom image. I combined them into one page. I can thank you guys for forcing me to do that, it was something that needed to be done! The reason I had to was because the javascript couldn't locate frames within a frame. All it could manage to do, as my layout was, was to open up the second page of frames, which displayed a messy and nightmarish layout of headers and content. Trust me, it was NOT pretty.

So yes, now I believe my site is working perfectly in both Internet Explorer and Firefox, and the site looks pretty much exactly like it did before I combined the pages. You won't be seeing an 'index1.html' again! Haha.

Thanks again!
kevinalle
theres no problem, we are here to help each other.
Web-mantaining is a nice job and must be done.
Good luck,
K
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.