Click on Pop-Up before Redirecting Main Page

Discussion in 'JavaScript' started by ToReRo, Oct 17, 2011.

  1. #1
    I've seen some website doing this.. but couldn't find any script that would actually do...

    When you click a link... a pop-up will show up... and unless you click something on the pop-up... the main page won't redirect you the destination link...

    anyone kind enough to share how is this being done?
     
    ToReRo, Oct 17, 2011 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    The target of the link is Javascript (in another part of the file) that pops up the alert, then redirects. Or it could redirect to a small page that has the thing you click on, which is another redirect to the actual page.
     
    Rukbat, Oct 21, 2011 IP
  3. SheetalCreation

    SheetalCreation Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #3
    do something (open pop up or something else) before navigating to a link, to do that need to capture the click event and then do action Like:

    <html>
    <head>
    <script type="text/javascript">
    function navigate(){
    alert("click on me");
    }
    </script>
    </head>
    <body>
    <a href="http://sheetalcreation.com" onclick="navigate();">web design and development company</a>
    <button onclick="ChangeSize ();">Change the size of the blue element</button>
    </body>
    </html>

    if at any time you want to stop navigating to link then you can use event.preventDefault()


    Sheetal G
     
    SheetalCreation, Oct 22, 2011 IP