
03-20-2005, 07:20 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 4
|
|
|
help: user must look at main page first. how?
Hello all.
I have a photography web page. I would like to force visitors to look at the main page first before they can navigate to the rest of the site.
I have been to other sites that when I link to a page other than the main page I get re-directed to the main page first, then I am allowed to navigate to other parts of the site.
How is this done?
Thank you!
|

03-20-2005, 10:02 PM
|
 |
Administrator
|
|
Join Date: Dec 2001
Location: Atlanta, Georgia, USA
Posts: 1,049
|
|
|
you would need some programming but basically you could set a cookie on the home page that shows it -- then if someone goes to another page directly it checks for the cookie - if no cookie then force to home page
|

03-21-2005, 12:17 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 4
|
|
|
OK I have figured out how to set a cookie with the value of copyright to expire when the browser closes, I put this code in the firs page and it seems to work fine...
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
createCookie('www.mysite.com','copyright',0)
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
var ck = name+"="+value+expires+"; path=/";
document.cookie = ck;
}
// -->
</script>
Now here is the tricky part, I put the following code in the second page (index2.html)...
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
go_to = "http://www.mysite.com/index.html";
function readCookie('www.mysite.com')
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
window.location = go_to;
}
// -->
</script>
What I want to do is if the cookie doesn't exist or is null then go to index.html otherwise just continue loading this web page. This is not working.
Any help.
|

03-21-2005, 06:12 AM
|
 |
Moderator
|
|
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
|
|
Can you post a URL?
That's basically how I did my site, and I didn't use any cookies. If done properly, a visitor goes to the site, and enters it from there. After entering, a new window is opened that contains my material. I use a code within those pages that if someone clicks a link to a page, it'll automatically take them to the main page within that set.
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
...,,.,.,.
/ \
__oooo__[///]--[\\\]__oooo__
Last edited by Leprakawn; 03-21-2005 at 06:14 AM.
|

03-23-2005, 06:06 PM
|
 |
Registered User
|
|
Join Date: Nov 2003
Location: Formby, UK
Posts: 239
|
|
Hi,
If you put the following in the body tag of each of your pages it will redirect to the specified page:
<body onload="if (top.location==self.location){window.location='htt p://www.mywebsite.co.uk/mypage';}">
Nice and simple
John
|

03-23-2005, 06:34 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 4
|
|
Quote:
|
Originally Posted by john-formby
Hi,
If you put the following in the body tag of each of your pages it will redirect to the specified page:
<body onload="if (top.location==self.location){window.location='htt p://www.mywebsite.co.uk/mypage';}">
Nice and simple
John
|
Yes but you can never go to a page with this in the body tag.
I only want to make sure visitors always start at my main page then they can navigate the rest of the site freely, I don't want to exclude them from pages altogether... 
|

03-23-2005, 06:49 PM
|
 |
Registered User
|
|
Join Date: Nov 2003
Location: Formby, UK
Posts: 239
|
|
|
Hi,
It doesn't exclude them, they can move freely through the site. All the code does is redirect them to a specific page, e.g. home, if they try to enter the site through another page. Once they are there, they can click links and go wherever they want.
John
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:38 PM.
|
|
|