[英]Scala Play framework URL in iframe is not working
我想在我的Scala播放视图中显示此iframe
;
<iframe src="http://localhost:9020/index.html#/group/sectiona/sectionb">Loading...</iframe>
如果我对该网址进行硬编码,则可以正常工作。 但是我希望它是动态的。 我试过了;
<iframe src="http://localhost:9020/index.html#/group/{{ 'http:\\//localhost:9020\\/#\\/group\\/' + myclass.section + '\\/' + myclassb.section }}/testtopic">Loading...</iframe>
<iframe src="http://localhost:9020/index.html#/group/{{myclass.section}}/sectionb">Loading...</iframe>
<iframe class="graphiframe" src="{{ 'http:\\//hello' + myclass.section + 'world'}}" frameborder="0" style="overflow:hidden" height="100%" width="100%">Loading...</iframe>
<iframe class="graphiframe" src="{{ 'http://hello' + myclass.section + 'world'}}" frameborder="0" style="overflow:hidden" height="100%" width="100%">Loading...</iframe>
等等..
这些都不起作用。 在4和5中,当我检查元素时,整个src都从iframe中消失了,并且我得到了一个iframe,其中包含错误消息Action not found. For request 'GET /%7B%7B%20'http:///hello'%20+%20myclass.section%20+%20'world'%7D%7D'
Action not found. For request 'GET /%7B%7B%20'http:///hello'%20+%20myclass.section%20+%20'world'%7D%7D'
和Action not found. For request 'GET /%7B%7B%20'http://hello'%20+%20myclass.section%20+%20'world'%7D%7D'
Action not found. For request 'GET /%7B%7B%20'http://hello'%20+%20myclass.section%20+%20'world'%7D%7D'
分别。 我已经对application.conf进行了更改,例如play.filters.headers.frameOptions = null
。 它使用Play 2.4.0。
我怎样才能解决这个问题?
您需要“神奇的'@'字符”: https : //www.playframework.com/documentation/2.6.x/ScalaTemplates
所以
<iframe src="http://localhost:9020/index.html#/group/{{myclass.section}}/sectionb">Loading...</iframe>
一定是
<iframe src="http://localhost:9020/index.html#/group/@myclass.section/sectionb">Loading...</iframe>
要么
<iframe src="http://localhost:9020/index.html#/group/@{myclass.section}/sectionb">Loading...</iframe>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.