1

我想知道这段代码有什么问题

<canvas> 
    <view y="50" width="100%" height="300" bgcolor="blue" onmousedown="res.apply()" onmouseup="res.remove()">
        <resizestate name="res"/>
        <dragstate name="drg"/>
        <text width="100%" bgcolor="gray" onmousedown="parent.drg.apply()" onmouseup="parent.drg.remove()">Drag here</text>
        <html id="ht" src="text.html" x="15" y="15" width="${parent.width - 30}" height="${parent.height - 30}"/>
    </view>
</canvas>

代码已编译,但我无法在 swf 版本中看到 html,但我能够在 dhtml 版本中看到 html。我也尝试指定网址仍然没有结果

4

2 回答 2

2

It looks like the <html> tag functionality is broken in the SWF10 runtime of OpenLaszlo 5.0 (trunk) for some Webkit based browser (Chrome and Safari), but there are other problems as well. I've modified the code a bit to do some testing:

<canvas>
  <button text="OpenLaszlo" onclick="ht.setAttribute('src', 'http://www.openlaszlo.org')" />
  <button y="40" text="test.html" onclick="ht.setAttribute('src', 'test.html')" />
  <view y="200" width="100%" height="300" bgcolor="blue" onmousedown="res.apply()" onmouseup="res.remove()">
    <resizestate name="res"/>
    <dragstate name="drg"/>
    <text width="100%" bgcolor="gray" onmousedown="parent.drg.apply()" onmouseup="parent.drg.remove()">Drag here</text>
    <html id="ht" src="http://www.openlaszlo.org" x="15" y="15" width="${parent.width - 30}" height="${parent.height - 30}"/>
  </view>
</canvas>

Here are the results I'm seeing with this code for the SWF10 runtime:

  • InternetExplorer 9, Chromium 18 and Opera 12: Both pages (local test.html and OpenLaszlo) are displayed within the iFrame.
  • Firefox: Remote website OpenLaszlo.org displays, but local test.html is not shown.
  • Safari 5.1 and Chrome 21: Both pages are not shown within the iFrame

I would file an OpenLaszlo Jira bug, and send a message to the laszlo-dev developer mailing list referring to this discussion.

于 2012-08-10T09:11:14.963 回答
1

自 2006 年以来,我一直在 OpenLaszlo 中进行开发,我个人尝试在 SWF 运行时下使用 OpenLaszlo <html> 标记的经验是,我加载到其中的一半页面可以正常工作,而其中一半不能。我遇到过即使来自 Google 的简单网页也无法运行的情况,这是一个非常不稳定的类,我不建议使用它。

于 2012-08-14T19:24:28.960 回答