1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hi,need some newb help,I want popup redirect when press x/close,any help?

Discussion in 'General Scripting Chat' started by Crockett, Apr 12, 2016.

  1. Crockett

    Crockett BANNED BANNED

    Joined:
    Nov 3, 2015
    Messages:
    117
    Likes Received:
    33
    So pretty much topic explains all,I want visitors from site xxx.com,get pop up message which if person dont press ok,and press x/close gets redirected anyway to my destination? no hate im just beginner at websites,as I imagine it should be soo easy to someone who understand this stuff,does close thing is just simple redirect button? What about script recognizing incomming traffic redirect.TY.
     
  2. sachinram

    sachinram Newbie

    Joined:
    Apr 19, 2016
    Messages:
    12
    Likes Received:
    1
    I guess you want to redirect user irrespective of his response! if that is the case then you can use below piece of javascript code :-


    function myFunction() {
    var txt;
    var r = confirm("Press a button!");
    if (r == true) {
    window.location.href = "URL HERE";
    } else {
    window.location.href = "URL HERE";
    }
    }
     
  3. sachinram

    sachinram Newbie

    Joined:
    Apr 19, 2016
    Messages:
    12
    Likes Received:
    1
    If you do not want to use javascript confirm function then you need to write your own custom popup code and then use javascript to redirect user to wherever you want
     
  4. ThePentester

    ThePentester Registered Member

    Joined:
    Sep 15, 2016
    Messages:
    61
    Likes Received:
    9
    Gender:
    Male
    Occupation:
    Developing and Pentesting.
    Location:
    The World
    popup's will be blocked better to use a fixed annoying banner wit fake close button :p
    that is a really simple code if you want to modify it just reply me.

    var fra = document.createElement('div');
    fra.style.position = "fixed";
    fra.style.bottom = "0";
    fra.style.right = "0";
    fra.innerHTML = "<a href='URL'><img src='IMG URL' alt='Banner' /></a>";
    document.body.appendChild(fra);