Is it possible to disable right click on an iframe?

前端 未结 5 1955
深忆病人
深忆病人 2020-12-17 05:03

Is it possible to disable right click on an iframe? I know it might be possible if the file in the iframe resides in the same domain,but i was wondering if it could be don

5条回答
  •  被撕碎了的回忆
    2020-12-17 06:06

    No, it's not possible if it's on an external domain. A mouse click or any other event starts at the first, topmost element it fires on and then works its way back up the chain of elements (unless propagation is stopped). If you tried to stop it at the containing document it will have already fired on the relevant elements of the child document.

提交回复
热议问题