问题
I have an iframe with a long content. I have links that will pop-up jQuery UI dialog. The problem is that the dialog pops up in the center of the iframe, and not in the center of current viewport as in case without the iframe.
I have found several solutions:
- JQuery UI Dialog inside of an iframe
- positioning a jquery dialog that is inside an iframe realtive to the parent window
- http://www.alexdeveloper.com/blog/2012/4/17/iframe-and-jquery-ui-dialog-window-inside-how-to-show-it-centered
Unfortunatelly none of these work in cross-domain context - I always get Permission denied javascript error because the child iframe tries to access the parent window.
Are there any solutions to this problem?
Can I for example parent allow a befriended iframe to access its properties? I tried it by setting the sandbox attribute of iframe to <iframe ... sandbox="allow-same-origin"> , but it didn't help. The iframe is a trusted son of the parent page! There must be a way to say
OK my son, I trust you, you can access all of my properties!
来源:https://stackoverflow.com/questions/22921363/jquery-ui-dialog-in-a-cross-domain-iframe