6

I getting the below error when trying to load some webpages

Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.

How do I solve it?

Anirudha Mahale
  • 2,526
  • 3
  • 37
  • 57
  • Please add your code snippets to elaborate your question, as this will help to identify the issue. Are you loading webpages using webview.loadUrl() method ? – Muhammad Sheraz Aug 29 '19 at 06:27

2 Answers2

7

If you are using webview.loadUrl() method to load a web page make sure that elements in the content attribute in meta tag (of web page's html) should have its elements comma "," separated neither semi-colon ";" nor blank space, for example:

Like this:

<meta name="viewport" content="key1=value1,key2=value2,key3=value3"> //best practice

Not even this, though supported but not recommended:

<meta name="viewport" content="key1=value1;key2=value2;key3=value3"> 

Not even this, though supported but not recommended:

<meta name="viewport" content="key1=value1;key2=value2;key3=value3">

So, see meta tag in your html's head tag having name="viewport", it should have it elements (i.e. key=values) comma separated in its content attribute, so after fixing it should like this:

<head>
...
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
....
</head>

Ref: https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag

Also see this similar thread: Android Webview - Scale image to fit screen properly with one loadUrl

Muhammad Sheraz
  • 569
  • 6
  • 11
  • I have the same scenario but the website is not my website and cannot change its source code. How to handle in that case? Most mobile browser loads without a problem. – Tony Lip Jul 19 '20 at 02:24
-1

I was able to solve this issue by implementing the below code:

webView_courseLesson.settings.javaScriptEnabled = true
webView_courseLesson.settings.loadWithOverviewMode = true
webView_courseLesson.settings.useWideViewPort = true

By default the javaScript support is turned off by the Android framework. Though you can check documentation here http://developer.android.com/guide/practices/security.html

Anirudha Mahale
  • 2,526
  • 3
  • 37
  • 57
  • "Error parsing a meta element's content: ';' blablabla", when you look in the page source code there is indeed a ";" in the meta tag. because of this the webview is blank. – sliders_alpha Oct 17 '18 at 09:24