jQuery UI dialog in a cross-domain iframe

喜夏-厌秋 提交于 2019-12-24 12:34:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!