开发者

How to replace HTML tag in URLRequest Flex 4 / Air

I am embedding a website into my application, and Adobe Air does not recognize the breakline HTML tag in the source code (Firefox and Chrome auto-correct the error). I have attached the source code below. Is there a way to replace the breakline with the correct syntax (no forward slash). I do not control the website, I am merely loading it into my application, so I can't just change it at the source. I am using an mx:html object and htmlLoader to load the url.

Website Source:

<ul>
    <li><a href="Rpt_Selection_2.asp?Report=StatusReport/StatusReport.asp">Status Report</a></li>
    <li><a href="Rpt_Selection_2.asp?Report=StatusReport/AlarmsAlerts.asp">Alarm History</a></li>
</ul>

<br/>

<table class="Header" cellspacing="0" cellpadding="0" border="0">
    <tr>
      <td class="HeaderLeft"><img src="Images/Spacer.gif" border="0"></td> 
      <th>List of&nbsp;Alarms for Multiple Groups&nbsp;</th>
 开发者_StackOverflow     <td class="HeaderRight"><img src="Images/Spacer.gif" border="0"></td>
    </tr>
</table>

mxml Component:

<mx:HTML  id="htmlControl" width="100%" height="100%"/>

Script to load URL:

htmlControl.htmlLoader.load(new URLRequest("http://mysite.com/somepage.asp"));

Thanks you.


The way I've handled this in the past was to use a URLLoader to first retrieve the content, then modify it, then set the content into an HTML component by calling myHtmlComponent.htmlLoader.loadString(myModifiedContent)

Hope that helps.

EDIT: After reading the comment below, you may be having trouble with loading referenced scripts if they are referred to using a relative URL rather than the full URL. I've fixed this in the past by prepending a base tag so the relative URLs can resolve properly. After retrieving the content, and before calling myHtmlComponent.htmlLoader.loadString, prepend like so:

myModifiedContent = "<base href='http://mydomain.com/'/>" + myModifiedContent;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜