Be a Supporter!

Frames like NG uses..

  • 285 Views
  • 7 Replies
New Topic Respond to this Topic
RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Frames like NG uses.. 2001-08-07 14:17:20 Reply

On my "todo" list for my site, is the cookie thing for the forum- and this. As i use IFRAMES for my site- i am in desperate need of a script for detecting if the user is in my IFRAME and if not, loading the homepage and putting the page they were just on into the iframe. I have tried my own methods using the REFERER function in PHP..with no avail..and have searched high and low for it with no luck. I even emailed Ross (from NG) asking for some help..no reply!

I think you all now know what i need, ANY of your help is very much appreciated. :)

aladinsane
aladinsane
  • Member since: Jan. 17, 2000
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Frames like NG uses.. 2001-08-07 14:50:58 Reply

At 8/7/01 02:17 PM, RichL wrote: stuff

Why don't you just look at the source to this page?

It's all there plain to see.

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Frames like NG uses.. 2001-08-07 15:14:46 Reply

Thats only the javascript of it though! There is blatently a "frames.php" page..as, lets say you type in (straight to your browser) http://www.newgrounds.com/bbs/. It redirects that page to: http://www.newgrounds.com/frames.php?location=/bbs/. And there you have it. a frames.php page- which i cannot view the source for! ???

aladinsane
aladinsane
  • Member since: Jan. 17, 2000
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Frames like NG uses.. 2001-08-07 15:30:11 Reply

At 8/7/01 03:14 PM, RichL wrote: Thats only the javascript of it though! There is blatently a "frames.php" page..as, lets say you type in (straight to your browser) http://www.newgrounds.com/bbs/. It redirects that page to: http://www.newgrounds.com/frames.php?location=/bbs/. And there you have it. a frames.php page- which i cannot view the source for! ???

Yeah, but that's the easy bit! The frames.php page I presume is just a normal frameset but the contents of the middle frame are determined by the location variable.

Look at the source to frames.php and there is a line like this:

<frame name="main" src="/bbs/" noresize>

The only bit of PHP needed is src="<?php echo"$location"; ?>" which in this case equals /bbs/ . Simple.

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Frames like NG uses.. 2001-08-07 17:25:45 Reply

I can honestly say i have no idea how to set it up. First off i cant find the exact piece of Javascript i need-as i dont know if im missing anything..and i dont see how the javascript could set a $location variable!

aladinsane
aladinsane
  • Member since: Jan. 17, 2000
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Frames like NG uses.. 2001-08-08 08:15:22 Reply

At 8/7/01 05:25 PM, RichL wrote: I can honestly say i have no idea how to set it up. First off i cant find the exact piece of Javascript i need-as i dont know if im missing anything..and i dont see how the javascript could set a $location variable!

I think you'll find this is the bit you need:

var main_frame = "/main.html"; // The main content frame
var bottom_frame = "/nav_bottom.html"; // This is the lower nav frame

if((self.location.pathname != bottom_frame) && (self.location.pathname != "/header.html")) // Only check middle content
{
if((!(top.main)) || (self.location.href != top.main.location.href)) // We've gotta break into our frameset.
top.location.href = "http://www.newgrounds.com/frames.php?location=" + window.location.pathname + window.location.search;
}

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Frames like NG uses.. 2001-08-08 10:56:29 Reply

I think you'll find this is the bit you need:

var main_frame = "/main.html"; // The main content frame
var bottom_frame = "/nav_bottom.html"; // This is the lower nav frame

if((self.location.pathname != bottom_frame) && (self.location.pathname != "/header.html")) // Only check middle content
{
if((!(top.main)) || (self.location.href != top.main.location.href)) // We've gotta break into our frameset.
top.location.href = "http://www.newgrounds.com/frames.php?location=" + window.location.pathname + window.location.search;
}

Right. Im using a single iframe, so i guess i would have this:

var main_frame = "/echeats.php"; // main content

if((self.location.pathname != main_frame) && (self.location.pathname != "/header.html")) // Only check middle content
{
if((!(top.main)) || (self.location.href != top.main.location.href)) // We've gotta break into our frameset.
top.location.href = "http://www.newgrounds.com/frames.php?location=" + window.location.pathname + window.location.search;
}

No im lost. I really feel stupid in asking- and i know its a bit of a strech..but i dont want to delete anything i dont know (Javascript is NOT my strong point). If you could take a look at it- i have a main page called "echeats.php", with an iframe for content named "iframe" (original huh)..i would need it to direct (if not in iframe) to echeats.php and place that page into the iframe of echeats.php...(e.g. not the default SRC page). Im really stumped with this...as i said- i normally use HTML and PHP..javascript is something i have yet to master ;). If you would give some more time to help me out with this i would be very thankfull.

<deleted>
Response to Frames like NG uses.. 2001-08-12 07:52:08 Reply

lol