Remove Flash Object tags from a web feed

You must Login before you can answer or comment on any questions.

Hi, While iOS doesn't support flash, there is STILL no reliable way to remove Object tags from a HTML string before parsing it into a local web view. This either ends up as just a blank part of the screen or in my case it actually shows the code since for some reason the feed contains ascii code for the opening of the tag.

Search on the internet and overall consensus is that you cannot 100% reliably remove HTML tags with a regex. However that is the only method we have when dealing with iOS yet the following are not working for me.

//replaceStr = replaceStr.replace(/<h3>[\s\S]*?Related.*Videos.*\(Embedded\).*<\/h3>[\s\S]*?<ul>[\s\S]*?<\/ul>/gmi," ");
                replaceStr = replaceStr.replace(/\&#60\;\/?object(\s\w+(\=\".*\")?)*\&#62\;/g," ");
                replaceStr = replaceStr.replace(/<object\\b[^>]*>[^<]*(?:(?!<\/?object\\b)<[^<]*)*<\/object\\s*>/g," ");

The text of the feed is

<li>&#60;object classid=&#34;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&#34; width=&#34;402&#34; height=&#34;267&#34; title=&#34;Cardiac risk assessment - Video&#34;&#62;
                        &#60;param name=&#34;movie&#34; value=&#34;http://c.brightcove.com/services/viewer/federated_f9?isVid=0&#38;amp;isUI=1&#38;amp;playerID=1033065488001&#38;amp;videoID=681437645001&#34; /&#62;
                        &#60;param name=&#34;allowfullscreen&#34; value=&#34;True&#34; /&#62;
                        &#60;param name=&#34;wmode&#34; value=&#34;transparent&#34; /&#62;
                        &#60;param name=&#34;swfLiveConnect&#34; value=&#34;true&#34; /&#62;
                        &#60;param name=&#34;dynamicStreaming&#34; value=&#34;True&#34; /&#62;
                        &#60;!--[if !IE]&#62;--&#62;
                        &#60;object type=&#34;application/x-shockwave-flash&#34; title=&#34;Cardiac risk assessment - Video&#34; data=&#34;http://c.brightcove.com/services/viewer/federated_f9?isVid=0&#38;amp;isUI=1&#38;amp;playerID=1033065488001&#38;amp;videoID=681437645001&#34; width=&#34;402&#34; height=&#34;267&#34;&#62;
                            &#60;param name=&#34;allowfullscreen&#34; value=&#34;True&#34; /&#62;
                            &#60;param name=&#34;wmode&#34; value=&#34;transparent&#34; /&#62;
                            &#60;param name=&#34;swfLiveConnect&#34; value=&#34;true&#34; /&#62;
                        &#60;!--&#60;![endif]--&#62;
                        &#60;p&#62;&#60;strong&#62;Viewing video content in NHS Choices&#60;/strong&#62;&#60;/p&#62;
                        &#60;p&#62;If you do not have a version of the Flash Player you can download the free &#60;a href=&#34;http://www.adobe.com/products/flashplayer/&#34;&#62;Adobe Flash Player&#60;/a&#62; from Adobe Systems Incorporated.&#60;/p&#62;            
                        &#60;!--[if !IE]&#62;--&#62;
                        &#60;/object&#62;
                        &#60;!--&#60;![endif]--&#62;
                    &#60;/object&#62;</li>

Can anyone tell me where i am going wrong? The text of the tag appears in my web view. The feed is controlled by a large company who are not going to make any changes just for me, so that option is out.

Thanks,

— asked 10 months ago by Jez Manser
1 Comment
  • So, the easiest way to do this is to change the ASCII codes for their representative characters and then a "you dont have flash" message is shown.

    This is at least better then the code showing.

    Although i would prefer if it said "you can't have flash because you're a dead guy's B*tch" .. lol.

    — commented 10 months ago by Jez Manser

Your Answer

This question has been locked and cannot accept new answers.