2016-02-01 10:47
浏览 68


I have a rather tricky problem. I work with a client who are restricted to only use HTML, CSS and JavaScript. We have build a form using PHP and Javascript - and currently we only find it possible to embed the form using an iFrame. We have no FTP-access, so the iFrame is loaded from a different domain.

While the form use JavaScript to load new questions and results, this makes it difficult for the height to fit the screen. If the frame fits some of the screens, it will cut off some elements on other screens. While I am unable to upload any files to the FTP that contains the iFrame, it is not possible to use the helper-file solution, as described here.

So, my question is: is it possible to add a JavaScript action that change the css of the iFrame height, when a specific div id is loaded / action executed?

Thanks in advance! :)

EDIT: I decided to solve this differently. But in case anyone else will stumble across this post, I think the solution offered here might work (if the code is updated to fit the latest jQuery). The main problem in my case seemed to be the limited access to the client domain.

图片转代码服务由CSDN问答提供 功能建议

我有一个相当棘手的问题。 我与仅限使用HTML,CSS和JavaScript的客户合作。 我们使用PHP和Javascript构建了一个表单 - 目前我们只能使用iFrame嵌入表单。 我们没有FTP访问权限,因此iFrame是从不同的域加载的。

虽然表单使用JavaScript加载新的问题和结果,但这使得高度难以适应 屏幕。 如果框架适合某些屏幕,它将切断其他屏幕上的一些元素。 虽然我无法将任何文件上传到包含iFrame的FTP,但无法使用帮助文件解决方案,如此处所述

所以,我的 问题是:是否可以添加一个更改iFrame高度的css的JavaScript动作,当加载特定div id /执行动作时?

提前致谢! :)

编辑:我决定以不同方式解决这个问题。 但是如果其他人偶然发现这篇文章,我认为该解决方案提供了这里 可能会工作(如果代码更新,以适应最新的jQuery)。 我的主要问题似乎是对客户域的访问受限。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doq8211 2016-02-01 13:18

    You can't control the parent window document property if the iframe is from different domain. How ever you can try busting out of the iframe.

    打赏 评论

相关推荐 更多相似问题