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

  • SEARCH
  • Home
  • 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 7772847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:58:29+00:00 2026-06-01T16:58:29+00:00

When you check the Gmail’s client source code. There is VIEW_DATA variable holds many

  • 0

When you check the Gmail’s client source code. There is VIEW_DATA variable holds many stuff related to user’s data. Is it possible to access this data via Javascript?

  • 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-01T16:58:31+00:00Added an answer on June 1, 2026 at 4:58 pm

    It looks like at some point after it’s used VIEW_DATA is reset to undefined, perhaps to save memory. Gmail seems to keep almost everything neatly tucked away in closures which makes getting to it from the global context difficult.

    One possible—but fragile—approach would be to query the DOM for the <script> element where VIEW_DATA is defined, which would give you the original script, letting you eval() it in your own context. E.g.:

    // get all of the <script> elements on the page
    var scripts = document.getElementsByTagName( 'script' ),
        thisScript, varViewDataPos, viewDataScript, viewData
    ;
    
    // loop through each one looking for VIEW_DATA being defined
    for( var i = 0; i < scripts.length; i++ ) {
      thisScript = scripts[ i ].textContent;
      varViewDataPos = thisScript.indexOf( 'var VIEW_DATA=' );
    
      if( varViewDataPos >= 0 ) {
        // might as well toss everything before VIEW_DATA is defined
        viewDataScript = thisScript.slice( varViewDataPos );
        break;
      }
    }
    
    // eval what we found (if anything), but in a closure to avoid polluting
    // the global namespace
    viewData = ( function( script ) {
      eval( script );
      return VIEW_DATA;
    } )( viewDataScript );
    
    console.log( viewData || 'Oops, script not found.' );
    

    Like I said, though, like any screen-scraping this is pretty fragile. If Google moves anything around you may find yourself suddenly eval-ing things you don’t want to, like function calls that will end up breaking the page. Use it at your own risk.

    You may find find that ultimately other methods, like trying to find the data you’re looking for in the DOM instead, are more sensible.

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

Sidebar

Related Questions

I've got a gmail account that I use to check my IMAP mail from
Check this code (My Custom Keyboard): -(IBAction) updateTextBackSpace:(id)sender { if([txtview.text length]>0) { NSString *deletedLastCharString
Check the below code int add(int a, int b) { return a + b;
Check this example before reading the question - http://www.sqlfiddle.com/#!2/fcf3e/8 The following data comes from
I want to recreate how the gmail conversation list looks where you check the
First of all,check out this image Gmail uses this image to display the animated
import imaplib usr = 'someuser' pwd = 'somepwd' imap_server = imaplib.IMAP4_SSL('imap.gmail.com', 993) imap_server.login(USER, PASSWORD)
What is the way in Java through with I can check if the user
I have the follwoing mysql table called user user email count ranking sss sss@gmail.com
I am trying to read mail from an Imap Server (Gmail). I would check

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.