Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect orientation change in iframe

I have a Html page, inside that page there is a iframe. In the Iframe src page I have written code to detect orientation and do some things. The orientation change is detected when I launch the iframe URL separately in browser, but when I use iframe, the orientation change is not detected. Do I need to use any plug in for this?

like image 487
Tushar Thakur Avatar asked Oct 31 '22 23:10

Tushar Thakur


1 Answers

This will work only if your iframe is on the same domain, and if they fire 'orientationchange' event.

$(document).add(parent.document).on('orientationchange',function() {
 // your logic
});
like image 130
Matas Vaitkevicius Avatar answered Nov 12 '22 11:11

Matas Vaitkevicius