Capture mouse right click event inside a iframe using jquery

后端 未结 2 1996
余生分开走
余生分开走 2021-01-22 16:27

I need to capture right mouse click event inside a iframe in asp.net using any javascript or jquery codes.

below is the code i have tried so far.



        
相关标签:
2条回答
  • 2021-01-22 17:12

    Hey: this might help:

    How Enable Right Click in IFRAME with JavaScript

    or

    http://forums.asp.net/p/1818670/5042726.aspx/1?Capture+mouse+right+click+event+inside+a+iframe+using+jquery+

    This is not possible I'm afraid. When you're inside the iframe, you're in a second tag... Unless you own what's inside the iframe and are able to put your Javascript on the page within then it's impossble. iframes are very limited for many many security reasons.

    Please let me know if anyone thinks otherwise, happy to take this post off.

    Although Try this hack mentioned here: http://www.codingforums.com/archive/index.php/t-8824.html

    or here http://forums.mozillazine.org/viewtopic.php?f=19&t=371334

    cheers,

    0 讨论(0)
  • 2021-01-22 17:13

    It is possible if the page inside an iframe is on the same domain.

    IFrame page at same domain: http://fiddle.jshell.net/rathoreahsan/MNtw8/8/show/

    See Demo: http://jsfiddle.net/rathoreahsan/gJtkW/

    While if you access the page of an other domain inside an iframe like you are doing then it is not recommended.

    Edited: See some references given below, hope it will be helpful.

    1. the-iframe-cross-domain-policy-problem

    2. cross-domain-iframe-resizing

    0 讨论(0)
提交回复
热议问题