Getting the referer info into a form field?

E

Edwin Hannan

Hi

uising FP 2000


I want to know where my email enquiries (form results from an online app
form) have come form e.g fish4, wannadoo etc so when I print them off it
shows the name of the referer.

Can any one help

cheers
 
K

Kevin Spencer

You are aware that the referrer refers to the last PAGE visited, not the
last domain, right? So, if they come to the page from a page inside your
web, it will be the last page inside your web that they viewed.

That said, and assuming that people are linking from other sites directly to
your form, you can use JavaScript to do this. It is the document.referer
property. Example:

<script type="text/javascript"><!--
document.forms[0].TextBox1.value = document.referer;
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
E

Edwin Hannan

Kevin

Thanks for that.

I take your point on a visitor perhaps going to the home page first then
linking to the form, that could happen, would I use a session cookie to
store the referrer value?, If so what is the best code for this? (new to
cookies..been reading up on them:)

Cheers

Ed

--
Edwin Hannan
(e-mail address removed)
Kevin Spencer said:
You are aware that the referrer refers to the last PAGE visited, not the
last domain, right? So, if they come to the page from a page inside your
web, it will be the last page inside your web that they viewed.

That said, and assuming that people are linking from other sites directly to
your form, you can use JavaScript to do this. It is the document.referer
property. Example:

<script type="text/javascript"><!--
document.forms[0].TextBox1.value = document.referer;
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

Edwin Hannan said:
Hi

uising FP 2000


I want to know where my email enquiries (form results from an online app
form) have come form e.g fish4, wannadoo etc so when I print them off it
shows the name of the referer.

Can any one help

cheers
 
K

Kevin Spencer

Hi Edwin,

That would probably require some server-side programming to do right (or at
least easily), unless you put the same JavaScript into every page that
conditionally stored the referer in a Cookie, only if the referer was not
from the same domain, and if the Cookie did not exist already (which would
indicate that the user had navigated to a previous page from the different
domain, and therefore would not need to be reset). Using client-side
JavaScript alone, though, nice thinking - yes, a Cookie would be the way to
go. You would NOT want to set the Cookie's expiration. A Cookie without an
expiration expires at the end of the current User Session.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

Edwin Hannan said:
Kevin

Thanks for that.

I take your point on a visitor perhaps going to the home page first then
linking to the form, that could happen, would I use a session cookie to
store the referrer value?, If so what is the best code for this? (new to
cookies..been reading up on them:)

Cheers

Ed

--
Edwin Hannan
(e-mail address removed)
Kevin Spencer said:
You are aware that the referrer refers to the last PAGE visited, not the
last domain, right? So, if they come to the page from a page inside your
web, it will be the last page inside your web that they viewed.

That said, and assuming that people are linking from other sites directly to
your form, you can use JavaScript to do this. It is the document.referer
property. Example:

<script type="text/javascript"><!--
document.forms[0].TextBox1.value = document.referer;
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

Edwin Hannan said:
Hi

uising FP 2000


I want to know where my email enquiries (form results from an online
app
form) have come form e.g fish4, wannadoo etc so when I print them off
it
shows the name of the referer.

Can any one help

cheers
 
E

Edwin Hannan

Kevin

Thanks for your help.

I will experiment with Client side javascript session cookies to store the
http_referrer value.

I will look into server side scripting when I know I can do clent side:)

cheers

Ed

--
Edwin Hannan
(e-mail address removed)
Kevin Spencer said:
Hi Edwin,

That would probably require some server-side programming to do right (or at
least easily), unless you put the same JavaScript into every page that
conditionally stored the referer in a Cookie, only if the referer was not
from the same domain, and if the Cookie did not exist already (which would
indicate that the user had navigated to a previous page from the different
domain, and therefore would not need to be reset). Using client-side
JavaScript alone, though, nice thinking - yes, a Cookie would be the way to
go. You would NOT want to set the Cookie's expiration. A Cookie without an
expiration expires at the end of the current User Session.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

Edwin Hannan said:
Kevin

Thanks for that.

I take your point on a visitor perhaps going to the home page first then
linking to the form, that could happen, would I use a session cookie to
store the referrer value?, If so what is the best code for this? (new to
cookies..been reading up on them:)

Cheers

Ed

--
Edwin Hannan
(e-mail address removed)
Kevin Spencer said:
You are aware that the referrer refers to the last PAGE visited, not the
last domain, right? So, if they come to the page from a page inside your
web, it will be the last page inside your web that they viewed.

That said, and assuming that people are linking from other sites
directly
to
your form, you can use JavaScript to do this. It is the document.referer
property. Example:

<script type="text/javascript"><!--
document.forms[0].TextBox1.value = document.referer;
//--></script>

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Edwin Hannan" <edwin.hannan_AT_NOSPAM_ntlworld.com> wrote in message
Hi

uising FP 2000


I want to know where my email enquiries (form results from an online
app
form) have come form e.g fish4, wannadoo etc so when I print them off
it
shows the name of the referer.

Can any one help

cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top