On the whole, the put-the-JavaScript-in-comments trick appears to be no longer the recommended pattern, and so I'd encourage you to reconsider your plan to keep serving it that way.
You have obviously enabled JavaScript in the WebView
, otherwise it would not work when you tried removing the comments. I know of no other setting to tell WebView
to to ignore the comment markers.
You're welcome to examine the AOSP Browser code to try to find out what they do, though that code is nasty, brutish, and long. You could patch up the HTML before handing it to the WebView
. You could set a particular user agent on the WebView
and have your Web service hand back cleaned-up HTML for that user agent, leaving the rest of your Web service clients unaffected. And you can see if you get a response to your bug report, though there's no assurance of getting such a response.
Beyond that, I'm out of ideas.