3

For diagnostic purposes, I need to be able to disable HTML5 in Android's WebView, without disabling Javascript (i.e. keep WebSettings.setJavaScriptEnabled(true);)

To further clarify: I love the ability to play YouTube videos without any Flash plugin installed. It even works with setPluginsEnabled(false). I can do this thanks to WebView's HTML5 built-in support. Now, to test a certain function, I need to trigger DownloadListener.onDownloadStart() with a YouTube video without disabling Javascript.

Is this possible?

Update: Since I posted this question I discovered that at least DOM storage can be disabled. I haven't found a way to disable HTML5 video yet.

Community
  • 1
  • 1
uTubeFan
  • 6,664
  • 12
  • 41
  • 65
  • 5
    What do you mean by "disable HTML5"? Drop support for the new elements? Re-obscure the things the spec clarifies? ;-) – T.J. Crowder Apr 28 '11 at 18:51
  • 1
    @T.J. Crowder +1 for the clarification. "disable HTML5" in my case means disabling the ability to play YouTube videos via HTML5. I need to trigger `DownloadListener.onDownloadStart()` with such video. – uTubeFan Apr 28 '11 at 19:01
  • 1
    Not through Webview...could you use some custom JS to modify the the page DOM elements to turn the feature off..maybe.. – Fred Grott Apr 28 '11 at 20:43
  • @Fred Grott +1 for the insight. Indeed, I combed the set*() methods in [WebSettings](http://developer.android.com/reference/android/webkit/WebSettings.html) but couldn't find anything that may hint at the feature I am seeking. – uTubeFan Apr 28 '11 at 21:10

2 Answers2

2

I know it's very old question... Still, you may want to check this answer for an idea. The WebSettings class has these methods for enabling/disabling HTML5 features:

  1. setDomStorageEnabled(boolean flag) - Sets whether the DOM storage API is enabled.
  2. setDatabaseEnabled(boolean flag) - Sets whether the database storage API is enabled.
  3. setDatabasePath(String databasePath) - Sets the path to where database storage API databases should be saved.
  4. setAppCacheMaxSize(long appCacheMaxSize) - Note: deprecated in API 18.
  5. setAppCachePath(String appCachePath) - Sets the path to the Application Caches files.
  6. setAppCacheEnabled(boolean flag) - Sets whether the Application Caches API should be enabled.
Community
  • 1
  • 1
stumpped
  • 231
  • 2
  • 7
1

I am not sure that this question makes much sense. You're not going to be able to "disable" an HTML5 feature in a browser that supports it. The best you can probably do is to set a non-HTML5 doctype on the webpage, but even then most rendering engines (webkit included) will still gladly support those features (<video> tag, <canvas>, etc) that they implement.

It sounds like what you're really trying to do is test what happens with a streaming video on a particular device (with an older?.. version of webkit that doesn't support <video>). Is that right? In this case, I'm not aware of any version of Webkit that has ever been distributed with Android that does not have support for <video>, but I could be wrong.

digitalbath
  • 7,008
  • 2
  • 17
  • 15
  • Thanks +1 for trying to help. I explained in my original post that I need this for **diagnostic** (i.e. debug, troubelshoot) purposes. The only way I can make WebView trigger `DownloadListener.onDownloadStart()` is if I can **disable** HTML5. I have no control over the webpages through which I am trying to study my android code. So if HTML5 cannot be disabled I am basically stuck. – uTubeFan Jul 31 '11 at 18:08