Link to home
Start Free TrialLog in
Avatar of edperks
edperksFlag for United States of America

asked on

Disclaimer Script

Hello,

I am building a Website for a Bank and they want a Disclaimer POP-UP to open everytime you click on a link that leaves their domain. examle" You are now leaving the First Bank Website First Bank is not responble for content provided by linked sites."
There site is going to have dozens of links to off site news,weather,stock market info, ect. I am in great need of some help coming up with a script in asp, cgi, javascript. I have tried my self but the popup comes up for internal links as well.

Thanks for help

Ed

Avatar of Wim_Bl
Wim_Bl
Flag of Belgium image

Hi,

can't you use the "onclick" event for the link, like this:

<a href="stockmarketsite" onclick="return showDisclaimer()">stock</a>

In the header, use a javascript:

<head>
<script>
   function showDisclaimer
   {
        // show the pop-up window here. use a modal form so the user has to click it away before going on
        return true
    }
</script>
</head>

I'm not sure about the exact syntax but you'll understand what I mean. You can even put the redirect itself in the javascript function, like this:

    //....
    //show popup
    window.location = "www.stockmarketsitestuff.com"


greetings
Avatar of ThaSmartUno
ThaSmartUno

similar to what Wim had said ... i use this for every external link on my intranet ...

<a href="javascript:externalLink('http://www.somesite.com');">
technically it should be
<a href="#" onclick="externalLink('http://www.somesite.com');">

but anyways ... the js code is just this
<script type="text/javascript">
<!--

function externalLink(lnk) {
  var popU;

  if (confirm(lnk+'\n\nDo you want to view this page?\nIt is outside of the intranet, so this only works if you have internet access.')) {
    popU = window.open(lnk,'_blank');
    if (!popU) {
      alert('Link was blocked.');
    }
  }
}
//-->
</script>
ASKER CERTIFIED SOLUTION
Avatar of cb1393
cb1393
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
just to fix my typo ... where I said it should be: (this is what it really should be)
<a href="#" onclick="externalLink('http://www.somesite.com');return false;">
Avatar of edperks

ASKER

Thanks cb1393 ,

Thats exactly what I was looking for!!