简体   繁体   English

如何在Ember中将“POST”类型页面加载到iframe中?

[英]How to load a 'POST' type page into an iframe in Ember?

I have an old JSP page in my project. 我的项目中有一个旧的JSP页面。 I need to include this page into my new page, where my new UI side is complete EmberJS. 我需要将此页面包含在我的新页面中,其中我的新UI端是完整的EmberJS。

Things that I have tried 我尝试过的事情

  1. I got the rendered HTML from JSP using an ajax call and try to render with {{{ var }}} handlebar, But there are lots of scripts inside the page. 我使用ajax调用从JSP获取渲染的HTML并尝试使用{{{var}}}把手进行渲染,但页面内有很多脚本。 They are not getting parsed or executed. 它们没有被解析或执行。

How can I load the page into an iframe? 如何将页面加载到iframe中? The page is POST type. 该页面是POST类型。

You can create a hidden form that point the target to the iframe , then trigger the click() event on the hidden submit button when document loaded. 您可以创建一个隐藏的表单,将目标指向iframe ,然后在加载文档时触发隐藏的提交按钮上的click()事件。

For Example 例如

<form action="YOUR_JSP_URL" method="post" target="myIframe">
  <input id="postToIframeBtn" style="display: none" type="submit" value=" " />
</form>

<iframe name="myIframe" src=""></iframe>
<script>
document.getElementById("postToIframeBtn").click();
</script>

Short answer, try to insert them into DOM inside components didInsertElement hook using jQuery. 简短的回答,尝试使用jQuery将它们插入到组件didInsertElement钩子里面的DOM中。

Do not use {{{}}} it only work with HTML inserting. 不要使用{{{}}}它只能用于HTML插入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM