Reply
Interesting Idea, anyone??
Old 08-29-2002, 07:29 AM Interesting Idea, anyone??
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
An idea struck me...about a minute ago.

The site that I work for, SafariQuip, is operated on a frames basis. As many problems as this causes, that is the way the site works.

Recently, for reasons as yet unknown to me, the menu started ranking higher than the main page on google.

obviously this causes problems because we want people to see the main page, not the menu on its own with no front page.

is it possible, does anyone have, could anyone create, a script that identifies if the page is part of a frameset?

if the page is already within a frameset, nothing happens. but, if the page is not within a frameset, it "refreshes" or "redirects" the page to the main page of the site.

this would solve many of my problems as it would mean even when people clicked onto the menu, highly ranked in google, they would get the main page of the site, and all would be well.

your time and help is much appreciated.
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 08-29-2002, 03:22 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
I'm not sure exactly how to write this, but I think the best way to do it would be based on referrers. You'd need to check but IIRC you will get your own site as the referrer for any pages loaded in the frameset, so all you need to do is to detect that if the referrer is not your site, the page should refresh to the main page.
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
Old 08-29-2002, 03:36 PM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
makes sense. ideas on how i put in a detection for IIRC? this would save a lot of hassle.

think i might contact my hosting company for ideas...also gotta talk to them about auto-refreshing 404 pages...interesting stuff this web design...

keep the ideas comming guys!!
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 08-31-2002, 03:28 AM
Mo Money's Avatar
Extreme Talker

Posts: 229
Location: Cali
HERES THE SCRIPT MY FRIEND:

<script language="JavaScript">
if (parent.location.href == self.location.href){
window.location.href = 'index.html'
}
</script>

Now to eddit the script you just change where it says index.html to whatever the page is that you want it to show. Just add that into the <head></head>
section of the code on the menu page and it will show the main site! Good Luck
__________________
AbcArcade.com - Free Internet Games!
Mo Money is offline
Reply With Quote
View Public Profile Visit Mo Money's homepage!
 
Old 09-01-2002, 09:15 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
thankx for the script. this means that if the page loads on its own, it refreshes to the frames page, but if it loads as part of a frameset it stays as it is? correct?

this is very important as it is for use on a commercial site.
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 09-01-2002, 04:15 PM
Mo Money's Avatar
Extreme Talker

Posts: 229
Location: Cali
im not sure i would guess that it wouldnt effect a frame but i cant be sure why dont you test it out
__________________
AbcArcade.com - Free Internet Games!
Mo Money is offline
Reply With Quote
View Public Profile Visit Mo Money's homepage!
 
Old 09-01-2002, 06:54 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Or you can check for frames not being present using
if(!(parent.frames.length > 0))
{
window.location.href = 'index.html';
}

-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 09-02-2002, 05:28 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
dk, that needs to be surrounded with <script language="JavaScript" > doesn't it? will that script work as a refresh to frames page if no frames present? if it does, it'll solve all my problems i'll go try it out, many thankx guys
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 09-02-2002, 06:51 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
having tried out both scripts, they both worked, did the right job.

i've got Dk's script up, purely because it was the 2nd one i tried, and was equally as slow. if either of you know how i can make the script work faster than it does...at present the page doesn't load, it just stops loading, then waits a few seconds, then loads the index.php page.

the page is viewable at www.safariquip.co.uk/vivid/menu/menu_new.html

lemme know what you think. by the way, you won't see the page, it should just redirect through to the index.php page.

anyone with say...a php redirect script that would be faster, please let me know!

thankx for all your help guys!!
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 09-02-2002, 12:29 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Glad that worked. I think the link you are talking about is:
http://www.safariquip.co.uk/vivid/menu/menu.html
Anyways it worked so fast I couldnt even see the page before it loaded so i guess its working. By putting it at the top of the <head> you ensure it loads before anything else.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 09-12-2002, 07:21 PM
Tiggy's Avatar
Ultra Talker

Posts: 250
Location: Lancashire, UK
Unfortunately the only concievable way I can think of that does it in PHP would rely on the HTTP_REFERER variable - which is not the best of things to use, but all that is available at the point of displaying the page for the first time.

You could check to see if the referring page is your frameset page and redirect if it isn't - but there is the problem of missing and munged referrers to deal with (and with privacy options growing, this is a growing problem). I suppose you could set a cookie at the same time as redirecting (if needed) to say that they have been redirected once, to avoid them going around endlessly in circles... not sure it would be faster at all, but it could save you unnecessary bandwidth if done correctly and it does not rely on JavaScript support.

Please don't ask me how to implement it tho, I'm no expert at PHP and am too lazy to look it up.
__________________
Web Site Owner's Resource - http://websiteowner.info
Tiggy is offline
Reply With Quote
View Public Profile Visit Tiggy's homepage!
 
Old 09-13-2002, 05:46 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
I have looked at his site Tiggy and I think he got it working using one of the javascripts above.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 09-13-2002, 07:06 PM
Tiggy's Avatar
Ultra Talker

Posts: 250
Location: Lancashire, UK
I know he got it working, but he thought that using a server side script might be faster... I was just thinking through how this might be done and the pros and cons of doing it server side rather than client side. Not sure if it would be faster than client side tho, it could be seeing as you could redirect before displaying a page to the user...
__________________
Web Site Owner's Resource - http://websiteowner.info
Tiggy is offline
Reply With Quote
View Public Profile Visit Tiggy's homepage!
 
Old 09-16-2002, 11:39 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Yes that may be true but does HTTP_REFFERER include anything about frames? I didn't know that it did. I guess if it would show the frameset that opened the page then you could just check for that. I guess it would take some experiementing.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Reply     « Reply to Interesting Idea, anyone??
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.19648 seconds with 12 queries