将带有远程内容的 iframe 附加到 dojo 容器

发布于 2024-12-29 08:32:04 字数 503 浏览 2 评论 0原文

我对 dojo 很陌生,想知道如何在 dojo 容器中拥有 iframe - 内容窗格或 borderContainer (我不需要访问 iframe 中的任何内容,也不需要通过 ajax 加载它- 只需将其放入我的应用程序中的内容窗格中即可。如果我可以以某种方式绕过 dojo 尝试加载的内容,我认为这可能会以某种方式导致解决方案,但我似乎无法找到解决方案。直接加载内容窗格当然,因为通过ajax加载引入了跨域考虑因素,我尝试过:

  • 使用内容和内容字符串 ''
  • dojo.create指定 url
  • 使用 dojo.iframe.send 并使用 dojo.io.script.get
  • 来创建 iframe 元素,

而 iframe.send 似乎确实返回数据(它看起来像一个有效的页面返回),我不知道如何设置 iframe 的内容。

I'm pretty new to dojo and was wondering how I could have an iframe within a dojo container - either a content pane or a borderContainer (I don't need to access anything in the iframe and don't need to load it via ajax - just plop it into a content pane in my application. If I could somehow bypass having dojo try to load stuff I think that might somehow lead to a solution. I've tried POJS (plain old javascript) and I can't seem to load the content pane directly because of the cross domain considerations introduced by loading via ajax of course. I've tried:

  • using the content and a content string '<iframe id="a" name="a" src="http://google.com"></iframe>'
  • using dojo.iframe.send with specifying the url
  • using dojo.io.script.get
  • dojo.create to create the iframe element

While the iframe.send did seem to return data (it looked like a valid page return), I didn't know how set the content for the iframe. Any pointers would be much appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪漫之都 2025-01-05 08:32:04

也许我误解了你的意思,但是将 ContentPane 的内容设置为 iframe 应该不是问题。

dijit.byId("targetPane").set("content", dojo.create("iframe", {
    "src": "http://www.stopacta.info",
    "style": "border: 0; width: 100%; height: 100%"
}));    

示例: http://jsfiddle.net/froden/8NemY/

Maybe I misunderstand you, but setting the content of a ContentPane to be an iframe shouldn't be a problem.

dijit.byId("targetPane").set("content", dojo.create("iframe", {
    "src": "http://www.stopacta.info",
    "style": "border: 0; width: 100%; height: 100%"
}));    

Example: http://jsfiddle.net/froden/8NemY/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文