The issue I am trying to solve is if my SharePoint Hosted App Part has a user specified width of 550px, and they are using my app part on a Public facing site with a mobile device channel, how do I get the window size of the parent?
I know i can use window.parent.postMessage to change the size of my app part but without knowing the parent window width I wouldnt know when to change the size to fit a mobile device.
What I have tried:
I have tried window.parent.innerWidth and $(window.parent).width() but both give me Access Denied which i know is by design due to security.
Setting my app part width to No. Adjust width to fit zone., which is not desired anyway, doesn't work with the OOB Public facing themes. This is undesired as the browser view is not the size I want, ie to small, and when viewed via mobile the app part is still getting cut off on the right.
Is there another technique I can use to find if my App Part is being viewed by a mobile device using JavaScript only?