Forum Moderators: open

Message Too Old, No Replies

history.back for main info page

using history.back for main info page

         

allllll

5:16 pm on Mar 4, 2007 (gmt 0)

10+ Year Member



Hi,
I'm setting up a site and I want everyone who visits to pass through the main info page first, no matter what page they're linking to from outside of the site. The info page will set a cookie once they click an "I agree blah blah blah..." link and then they can go anywhere in the site.
I've got it set up OK, but I want to figure out how to have the visitor directed to the page they were trying to visit with the original external link. I thought history.back would do it, but I guess the original page that they were trying to visit doesn't register in the history (at least with Safari and Mac Firefox) so it ends up taking you back to the external page that you're trying to use to link to the site from.
I'm not sure that I'm making that clear enough, so here's an example:
you see a link to my site: historyback.com/example.htm in your Google results. When you click the link your browser tries to take you to historyback.com/example.htm but there's javascript in the head section of that page that redirects you to historyback.com/main.htm (unless you already have a cookie from a previous visit). You go through main.htm and then click the "I agree blah blah blah..." link. At that point I want you to go back to historyback.com/example.htm or whatever other page you were trying to link to from outside the site.
Is this something I can do easily with javascript or should I get someone else to set up a server-side thisng for me?
Thanks!
Al

Trace

3:54 pm on Mar 5, 2007 (gmt 0)

10+ Year Member



You could check for the cookie using JavaScript, and if the cookie is absent redirect user to home page - but it wouldn't be very reliable (ex: user has JS turned off).

I would suggest doing it server-side.

rocknbil

9:57 am on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm setting up a site and I want everyone who visits to pass through the main info page first, no matter what page they're linking to from outside of the site.

Welcome aboard allll, but consider that this is a Bad Idea from the outset. Remember what *you* want and what your *vistors* want are not likely to be the same thing. If I were looking for Widgets with Green Protuberances and I followed a link that brought me to an All About Widgets page, my impression would be that what I've landed on has nothing to do with Green Protuberances. I know what I want (or think I do) and I'm now confused and disoriented, so I will never be back.

The info page will set a cookie once they click an "I agree blah blah blah..."

This is the second faulty assumption, that someone who visits your site is going to take the time to read. You yourself have presented what they see: "Blah blah blah" which is answered by "I don't care, I want my Widget with Green Protuberances and you give me mumbo-jumbo." You simply can't force feed something to your visitors, especially something as dry as a user agreement.

Lastly a redirect of this sort is really going to hurt you in search engine indexing. A better approach, if a user agreement is required, is a login on all pages - but this too will kill you on search engines.

However if you persist, I would do as suggested, a server side simple script that reads and saves the REQUEST_URI environment variable, and presents the main page, then does the redirect or provides the link. This would not be dependent on Javascript and would help with search engine digestion.

allllll

4:42 pm on Mar 8, 2007 (gmt 0)

10+ Year Member



Thanks for your thoughts! I need to do age verification so I guess I'll try to track down somebody to write up something for the server-side for me. I appreciate y'all taking the time to help me out!
Allll

rocknbil

8:00 am on Mar 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay, in this case, yes - use mod_rewrite to capture the incoming URL and point it to a script that first outputs the user agreement/age verification, which stores the requested URL. But make it just the agreement, not your main page. Less is more. :-D Then afer "I agree," set a cookie so you no longer need to capture the requests, and off to . . hmm . . . adult land . . . :-/