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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom "leaving" page

Status
Not open for further replies.

tfreeman2004

Technical User
Mar 15, 2004
14
US
Hello everyone, I have what sounds like a simple problem but I cant get anything to work.

I have about 20 links that lead to other sites, I need these links to point to a standard page that say your leaving this site click continue or cancel, javascript alert is unacceptable to the customer so it must be a custom page. How do I make the link attached to the continue button dynamic ?, read from a variable set by the sending link. I've googled for hours and hours and Im still empty handed, any solution would be appreciated, but bear in mind that 20-30 more links will be added shortly, I absolutly can't write a custom page for each link and know I don't have to, but man Im stumped as to how.
 
Just write a cgi script that takes as a parameter the page which the person is being sent to. The script will write out the note saying that they're leaving your site. It'll print the html for the "continue" link containing the url passed to it in the parameter. The "cancel" link can either be hard coded or also be passed to the script as a parameter.

For the links on your site, you'd have something like this:
Code:
<a href="/cgi-bin/leaving.cgi?url=[URL unfurl="true"]www.google.com">Google</a>[/URL]
<a href="/cgi-bin/leaving.cgi?url=[URL unfurl="true"]www.yahoo.com">Yahoo</a>[/URL]
and so forth.

Is that what you're looking for?
 
What about the generic page Ive made in plain html that has a back button where use javascript:history.back(1), but the continue button link needs to lead to where ever they were going, Ive seen versions of this with a timed redirect but I dont want the timer and that was javascript too, Im not fussy about the tool used but I want to understand why its working so I can build on it later, give me a hint of what exitPage.cgi might look like.
 
It depends on what cgi language you're using. Most commonly it would be Perl but could be PHP, ASP, JSP, etc. Pick one and get started on it and post back any specific questions you have.

 
I cant seem to google up the example Im look for I understand what I need to do I need to make th elinks on the sending page the way you said ie. href="with the contents of exitPage.cgi being

<?php
$varUrl="";
header(location: $_REQUEST['myGenericPage'];
?>

After it sends them to my generic page the continue button should hold the value of varUrl, Im seriously confused here, You would not believe how hard Ive dug and nobody has much advice for this, should I now be trying this is it not possible why doesnt anybody else do it this way instead opting for javascript timed redirect?
 
I am giving up on this for now, as I have to be done tonight or I dont eat this week, so Im writing out an individual page for each link, honestly I dont believe this will even work because out of two days of very hard searching and posting in forums not one person had any idea how to pull this off not to mention that I never saw any other sites using this method except one which used a javascript/asp combo that I was unable to get and read.Thanks for the help I did get I will no doubt be back when I need help.
 
Ok I started over with this and its a little closer to working for the links that lead away I have this.

<a href="redirect.php?url=" site</a>

Then for redirect php I have my page that I made for telling people they are leaving, th elink for the continue button is done like this

<a href="<?php echo("$url"); ?>">continue</a>

I have varied this in everyway I can think of and nothing works, everytime the link just leads to the parent directory this is all in. Please please tell me whats wrong, I begging here lol
 
I got it!!! I decided to start from scratch and do javascript even though my skills there are shaky as well but this worked great

sending link looks like this:

<a href="redirect.htm?xurl=http://www.externalSite">leave</a>

on redirect.htm I made the funtion setLink like:
function setLink(xurl){
xurl=document.location.search.substring(6);
window.open(xurl)
}

then finally made my goodbye link like:

<a href="javascript:setLink();" > talk to you later </a>

Now my question is why didnt I see this anywhere and why is this not a more popular topic, I imagine there is lots of use for it, but anyway I thought I would post my solution because I know there are people like me out there who need this but arent quite sure how to ask and this works beautifully.
 
html...

[red]<a href="<a href="<a href="[/red]

cgi...

[blue]#!/usr/bin/perl

print "Content-type: text/html\n\n";

print "you are leaving this site...\n";

print "<li><a href='$ENV{'QUERY_STRING'}'>$ENV{'QUERY_STRING'}</a>\n";
print "<li><a href='leaving.html'>cancel</a>\n";[/blue]

... obviously VERY basic


Kind Regards
Duncan
 
If two visitors click links destined to send data to cgi at the same time would sessions be needed to keep visitor a's variable seprate from vistors b's. I had thought that taking advantage of javascript being client side would make that scenerio go away, also what's basic to you isn't to me, I'm learning and obviously got a long way to go. So please bear with me.
 
You don't need to worry about two or more visitors - they aren't accessing the links directly but rather, the link's are on their computers so they are, in fact, working clinet-side.

There's always a better way. The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top