Mediating HTTP Requests

Discussion in 'JavaScript' started by adbox, Sep 7, 2009.

  1. #1
    Hola

    I am trying to detect all attempts at exit from my webpage,
    I want to pull in the url of a clicked link into a variable, run some string detection commands to see if it is the link im looking for, and then redirect it if it is.

    Can this be done?
     
    adbox, Sep 7, 2009 IP
  2. ceban

    ceban Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    with jQuery lib I would try this

    
    $(document).ready(function(){
    
    
    // onlick on any link
    $("a").click(function(){
    	// save href attribute in clicked_url
    	var clicked_url = $(this).attr("href");
    	
    	// then run the check on clicked_url variable and redirect
    	
    });
    
    
    });
    
    Code (javascript):
     
    ceban, Sep 7, 2009 IP
  3. adbox

    adbox Well-Known Member

    Messages:
    906
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    155
    Digital Goods:
    1
    #3
    thanks this might be a lead,
    what about if the link is within a flash video? will this still work?
     
    adbox, Sep 7, 2009 IP
  4. caprichoso

    caprichoso Well-Known Member

    Messages:
    433
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    110
    #4
    No, it won't work. Because Flash linking is managed inside Flash player and then direct to the browser.
     
    caprichoso, Sep 7, 2009 IP