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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amanjsingh
    New Member
    • Mar 2007
    • 48

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

    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
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    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....

    Code:
    if (location.hostname!='yourwebsite.com')
    alert ('You are going out of my site, baby...');
    I'm not sure about the syntax. Do confirm it.

    Comment

    • amanjsingh
      New Member
      • Mar 2007
      • 48

      #3
      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....

      Code:
      if (location.hostname!='yourwebsite.com')
      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.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        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 ?

        Comment

        Working...