Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8968363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:26:37+00:00 2026-06-15T17:26:37+00:00

i have a html string containing this: <!DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.01 Transitional//EN\>

  • 0

i have a html string containing this:

    <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
    <html>
      <head>
      <meta http-equiv="content-type" content="text/html; charset=windows-1250">
      <meta name="spanish press" content="spain, spanish newspaper, news,economy,politics,sports">  
      <title></title>
      </head>
      <body id="body">  
<!-- The following code will render a clickable image ad in the page -->
        <script src="http://www.myscript.com/a"></script>
      </body>
    </html>

I need to show that website into a webview in android.

I tryed with all this:

webView.loadDataWithBaseURL(null, txt, "text/html", "UTF-8", null);
webView.loadDataWithBaseURL("x-data://base", txt, "text/html", "UTF-8", null);      
webView.loadDataWithBaseURL("notreal/", txt, "text/htm", "utf-8",null);

Also i tryed removing DOCTYPE tag:

txt=txt.replace("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">", "");

No one of those have work. I just achieved to show the string into the webview (the html code), but not the website that must be created with that html code.

What is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:26:38+00:00Added an answer on June 15, 2026 at 5:26 pm

    To load your data in WebView. Call loadData() method of WebView

    wv.loadData(yourData, "text/html", "UTF-8");
    

    You can check this example

    http://developer.android.com/reference/android/webkit/WebView.html

    [Edit 1]

    You should add — \ — before — ” — for example –> name=\”spanish press\”

    below string worked for me

    String webData =  "<!DOCTYPE html><head> <meta http-equiv=\"Content-Type\" " +
    "content=\"text/html; charset=utf-8\"> <html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1250\">"+
     "<meta name=\"spanish press\" content=\"spain, spanish newspaper, news,economy,politics,sports\"><title></title></head><body id=\"body\">"+
    "<script src=\"http://www.myscript.com/a\"></script>şlkasşldkasşdksaşdkaşskdşk</body></html>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have document <?xml version=1.0 encoding=utf-8 ?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd>
I have a string containing html code, something like this: http://jsbin.com/ocoteg/1 . I want
I have this string containing a large chunk of html and am trying to
I have a JavaScript string containing HTML like this: <div> <div class=a> content1 </div>
If you have a string containing HTML entities and want to unescape it, this
I have a variable containing html string. This string has this particular code <a
I have a string contaning some html markup, like this: var html = <div>
I have a big HTML-string containing multiple child-nodes. Is it possible to construct a
I have a string containing HTML and I need to replace some words to
I have the following: string html_string = http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=pharma; string html; html = new WebClient().DownloadString(html_string);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.