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 8710559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:39:23+00:00 2026-06-13T04:39:23+00:00

I am trying to pull HTML data out of a WebView . I’ve seen

  • 0

I am trying to pull HTML data out of a WebView. I’ve seen this done a thousand times and I’ve even gotten it to work myself. However, my new project leads to an interesting situation: I need to login to a site through a WebView and then pull the HTML. Obviously, the Socket method doesn’t work, because in order for a webpage to be returned you need the cookie for authentication. I’ve also tried the JavascriptInterface trick, but that didn’t work either. I’m thinking the best way to achieve this is to use HttpGet with CookieManager? Does anyone know how I can get raw HTML code from a WebView with an auth cookie? Thanks!

EDIT: I did some JS injection and didn’t see any cookies… so it might not be a cookie issue? But the links that you get redirected to are generic, like mainPage?a=1 and infoPage. You cannot simply copy/paste the links into another browser you have to be logged in to view these links. For those of you who are web experts, you may know an easy solution.

  • 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-13T04:39:25+00:00Added an answer on June 13, 2026 at 4:39 am

    WebView isn’t really meant for getting HTML for programmatic use, the idea is that it’s just a direct window to a URL for user interaction.

    To get what you want, you can use a java.net.HttpURLConnection with a CookieManager, it’s worked fine for me on Android and it’s suggested in the Android SDK docs:

    // in an activity's onCreate:
    cookieManager = new CookieManager();
    CookieHandler.setDefault(cookieManager);
    
    // later on
    void getAPage(URL url) {
       HttpURLConnection huc = (HttpURLConnection) url.openConnection();
    
       System.out.println("hello from huc, response code is: " + huc.getResponseCode());
    
       // huc.getInputStream() gives you the content.
    }
    

    The CookieManager will persist all cookies through the lifetime of the application without you having to do anything extra. You can make posts with HttpURLConnection too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pull some data out of logs on remote machines using awk,
I'm trying to pull some html data from a mysql database to populate a
I am trying to pull out some HTML (a hrefs) from a long string
I'm trying to figure out how to pull data from multiple tables and making
I'm trying to pull meta tags out of a html page, to compare two
Working with PHP Xpath trying to quickly pull certain links within a html page.
I have been trying to use the document.getElementByID to pull information from an HTML
I am trying pull a field out of a string and return it. My
I'm trying to pull data from the YouTube API into a local MySQL table.
I'm trying to pull a project from git, in particular, this one: https://github.com/pocmo/Yaaic .

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.