Reputation: 950
Let's imagine someone is loading my website in an iFrame, and they've set the iFrame opacity to 0, what JavaScript can I use to detect my page currently has an opacity of 0?
Upvotes: 1
Views: 103
Reputation: 768
You can try this:
if($('element').css('opacity') == 0) {
doSomething();
}
To detect the opacity
Upvotes: 0
Reputation: 943569
None.
The opacity belongs to the frame, not to your site. The same origin policy prevents you from accessing the parent DOM to get details of the frame.
If you are concerned about clickjacking attacks, consider x-frame-options as a defence.
Upvotes: 3