#1 (permalink)  
Old 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!
Reply With Quote

  #2 (permalink)  
Old 03-20-2005, 10:02 PM
Allen's Avatar
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
Reply With Quote
  #3 (permalink)  
Old 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.
Reply With Quote
  #4 (permalink)  
Old 03-21-2005, 06:12 AM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
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.
Reply With Quote
  #5 (permalink)  
Old 03-23-2005, 06:06 PM
john-formby's Avatar
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
Reply With Quote
  #6 (permalink)  
Old 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...
Reply With Quote
  #7 (permalink)  
Old 03-23-2005, 06:49 PM
john-formby's Avatar
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 04:38 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter