uTubeFan
uTubeFan

Reputation: 6794

Disable HTML5 in WebView without disabling Javascript

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.

Upvotes: 3

Views: 2273

Answers (2)

stumpped
stumpped

Reputation: 231

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.

Upvotes: 2

digitalbath
digitalbath

Reputation: 7334

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.

Upvotes: 1

Related Questions