/    Sign up×
Community /Pin to ProfileBookmark

special link question

Maybe this is a long shot, but is there a way to make a link show up on a page only if you got to that page from a specific other page?

For example. If I have a link on page1.htm that goes to page2.htm but page3.htm also has a link to page2.htm. When I click the link from page1.htm I would like for a link to show up that says back to page1. I would only want that back link to show up if they came to page2.htm from page1.htm, not if they came from page3.htm.

If that makes any sense and is possible, please advise! Thanks a million!

dave

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@GotMex_Nov 21.2006 — You could maybe play with the "document.referrer" property. This will give you the url of the referring page, which you can then use to place the right link you want.
Copy linkTweet thisAlerts:
@cootheadNov 21.2006 — Hi there yodasw16,

does this help...

[b]page1.html[/b]
[color=navy]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>page1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>

<h1>this is page1</h1>

<div>
<a href="page2.html[color=purple]?1[/color]">page2</a>
</div>

</body>
</html>[/color]

[b]page2.html[/b]
[color=navy]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>page2</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.hide{
display:none;
}
-->
</style>

<script type="text/javascript">
<!--
window.onload=function(){
obj=document.getElementById('link')
num=location.href.split('?')[1];
if(num!=undefined) {
obj.firstChild.data='page'+num;
obj.href='page'+num+'.html';
obj.className='';
}
}
//-->
</script>

</head>
<body>

<h1>this is page2</h1>

<div>
<a id="link" class="hide" href="#"> </a>
</div>

</body>
</html>[/color]

[b]page3.html[/b]
[color=navy]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>page3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>

<h1>this is page3</h1>

<div>
<a href="page2.html[color=purple]?3[/color]">page2</a>
</div>

</body>
</html>[/color]

If you do not want a return link leave out the query string.

[i]coothead[/i]
×

Success!

Help @yodasw16 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...