Connecting Tech Pros Worldwide Forums | Help | Site Map

Show an advisory "Going to External Link" while the user is going out of my domain

Member
 
Join Date: Mar 2007
Posts: 48
#1: Feb 8 '08
Hi,

I have my website and want to perform this functionality most likely using PHP. Please note that the website is huge and manual editing of pages is not possible.

Is there a quick solution tom implement an advisory or an intermediate message like "You are not leaving www.xxxxx. domain and going to external website" when a user clicks on any "external" link on my website?

Thanks,
AJ

hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#2: Feb 10 '08

re: Show an advisory "Going to External Link" while the user is going out of my domain


Quote:

Originally Posted by amanjsingh

Hi,

I have my website and want to perform this functionality most likely using PHP. Please note that the website is huge and manual editing of pages is not possible.

Is there a quick solution tom implement an advisory or an intermediate message like "You are not leaving www.xxxxx. domain and going to external website" when a user clicks on any "external" link on my website?

Thanks,
AJ

That can't be done in server side scripting.
You need to add some javascript code....

use something like this....

on ONCLICK event of every link, you may need to add this....

Expand|Select|Wrap|Line Numbers
  1. if (location.hostname!='yourwebsite.com')
  2. alert ('You are going out of my site, baby...');
I'm not sure about the syntax. Do confirm it.
Member
 
Join Date: Mar 2007
Posts: 48
#3: Feb 10 '08

re: Show an advisory "Going to External Link" while the user is going out of my domain


Quote:

Originally Posted by hsriat

That can't be done in server side scripting.
You need to add some javascript code....

use something like this....

on ONCLICK event of every link, you may need to add this....

Expand|Select|Wrap|Line Numbers
  1. if (location.hostname!='yourwebsite.com')
  2. alert ('You are going out of my site, baby...');
I'm not sure about the syntax. Do confirm it.

Oh, that means change all the files anyways. I hoped there was an easy solution. thanks a lot for your help. No issues with the syntax, with so many languages it has become a pain anyways to learn that.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,948
#4: Feb 10 '08

re: Show an advisory "Going to External Link" while the user is going out of my domain


Quote:

Originally Posted by amanjsingh

Oh, that means change all the files anyways. I hoped there was an easy solution. thanks a lot for your help. No issues with the syntax, with so many languages it has become a pain anyways to learn that.

Are your pages served dynamically or file...ly ?
Reply