Highlight word in HTML Page

Talk about add-ons and extension development.
Posts: 3
Joined: September 4th, 2017, 4:01 am

Post Posted September 4th, 2017, 4:51 am

hi Guys,

I was updating my firefox-on which highlights few words based on some process. However. as Firefox has change few things, it no longer allow to directly update the body content of the webpage.

I get following error.

Code: Select all
Markup should not be passed to `innerHTML` dynamically.
Warning: Due to both security and performance concerns, innerHTML may not be set using dynamic values which have not been adequately sanitized. This can lead to security issues or fairly serious performance degradation.

vrs_getWin.document.getElementsByTagName("body")[0].innerHTML = bodyContents;

Does anyone know if there is an in-built api to highlight words in HTML. I don't know the id of the node so I can't append any child node to that, I only know word by it's text.

Return to Extension Development

Who is online

Users browsing this forum: No registered users and 1 guest