Detect Click On Iframe Then Do An Action

2019-08-20 15:01发布

I want to add a iframe to my website that has a button in it and when someone clicks on it, it does an action like maybe forward to another page or echo a message. I don't care about the code whether its java, php, html, etc as long as it works. I'm good at coding certain things but this is not one of them, help me out please.

UPDATE: the iframe is: iframe src="http://ipget.tk" /iframe

when its clicked on I want it to go to google.com the iframe will be on a test page on scazioco.com

1条回答
看我几分像从前
2楼-- · 2019-08-20 15:06

Using Jquery you can bind an event to your IFrame :

    $('#iframe_id').bind('click', function(event) { 
        window.location = http://www.google.com    
     });

Replace #iframe_id with the actual Iframe's ID

查看更多
登录 后发表回答