Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tell if your page has been loaded in frames or in someone elses frames

Status
Not open for further replies.

KnudNexo

IS-IT--Management
Jul 16, 2001
5
AU
I want to know if it is possible to have your perl script know if the page has been loaded inside your frames or has just been opened by a direct link (search engines seem to only provide the direct link to the content of your site and don't load up the other frames.)

If this is possible can you also tell if your page has been loaded up inside another pages frames?

Like if you link to your page in an email and someone reads that email in hotmail then when they click the link it opens the page with a hotmail frame at the top.

I have had a look in the FAQ but didn't find anthing on this.
 
Being relatively new to Perl myself, I am not sure how to go about it that way, but I know it can be done pretty easily using a little javascript placed in the head of the document.

I can also tell you that if there is an easy way to do it with Perl, someone much wiser than myself will be more than happy to help out.

For the javascript you could use:

Code:
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
if (top.location.href.indexOf(&quot;<yourpage.html>&quot;) == -1)
  top.location.href = &quot;url/you/want/to/redirect/to&quot;;
// -->
</SCRIPT>

That is off the top of my head so there may be a typo or similar there....

If you decide to use the script, you could drop by the javascript forum also and ask there.

Hope this helps,
Jim
 
Perl is executed on the server, which means that it has no idea whatsoever if frames are in use or not. Jim's JavaScript is probably the best you can get. //Daniel
 
Hi

The Javascript example above will redirect you to the main page for a site, complete with frames.

If you want to redirect your page so that you get the frame and then your subpage within it (not the default sub page) then this can also be done using query strings.

For example, I have set up my page as


If I want to jump directly to a sub page then I can do a link as


This loads the main page and frames, but sets the frames to point to the discussion list page instead of the default front page. Note that this site is not set up to stop you linking directly (without the frames) to a page on it (but that is easy to add)

This is easy to do, and please feel free to copy the Javascript code from my page. Note that some of the code is in the frameset which is a tad more difficult to view the source. Also note that for consistant behaviour between Netscape and IE I have set the site up to have a couple of virtually blank pages which are initially loaded before jumping to the required pages.

All the best

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top