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

Alert only on entering site 1

Status
Not open for further replies.

shmmeee

Programmer
Apr 17, 2001
104
GB
Hi,
I'm sure this has been asked before, but I can't find it so: I have an confirm box that pops up when someone goes to my homepage, however I only want it to pop up the first time the user enters the site and not if they're clicking "home" on another page on my site.
Is there a way to find out if the user came from within my site and to disable the confirm box if they did?

TIA,
Iain
 
Sure. Just use this code:

Code:
<script language=&quot;javascript&quot;>
<!-- Hide script from old browsers

if (document.referrer.indexOf(&quot;[URL unfurl="true"]http://www.mydomain.com&quot;)[/URL] != -1)
{
confirm(&quot;confirm this?&quot;);
}

// End hiding script -->
</script>

Hope that helps!

Happy coding! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top