Results 1 to 2 of 2

This is a discussion on Get the reference of active window within the Plugins Development section, part of the Chrome Plugins category: I use the following code to access the innerHTML of the page. But I am geeting error, rather then the ...


  1. #1
    Gaurang033 is offline Junior Member
    Join Date
    May 2009
    Posts
    9

    Default Get the reference of active window

    I use the following code to access the innerHTML of the page. But I am geeting error, rather then the innerhtml. Can you guys tell me what am i doing wrong here ???
    Code:
    chrome.windows.getSelected(function(window){
    	console.log(window.document.getElementsByTagName("body")[0].innerHTML);
    	});

  2. #2
    rock_galore is offline Junior Member
    Join Date
    May 2009
    Posts
    23

    Default

    Quote Originally Posted by Gaurang033 View Post
    I use the following code to access the innerHTML of the page. But I am geeting error, rather then the innerhtml. Can you guys tell me what am i doing wrong here ???
    Code:
    chrome.windows.getSelected(function(window){
    	console.log(window.document.getElementsByTagName("body")[0].innerHTML);
    	});
    We just told you here that this won`t work.
    1. to access the current window use getCurrent
    http://dev.chromium.org/developers/d...ns/windows-api

    2. to access the current tab use getSelected
    http://dev.chromium.org/developers/d...sions/tabs-api
    The windowId can be null to access the current window.

    3. The extension still can not access the DOM of the current page
    http://groups.google.de/group/chromi...0aedb89dc42bef

    So, if you use the correct syntax, which would be something like that
    Code:
    chrome.tabs.getSelected(null,function(tab)	{
        console.log(window.document.getElementsByTagName("body")[0].innerHTML);
    })
    it would only give you the body of the toolstrip. Nothing more, nothing less.

Similar Threads

  1. Access inner html of page of active tab
    By Gaurang033 in forum Plugins Development
    Replies: 15
    Last Post: 05-16-2011, 10:51 AM
  2. Which Extensions are Active
    By pjfla in forum Chrome Plugins
    Replies: 15
    Last Post: 06-05-2009, 12:52 PM
  3. How to keep download going when closing the window?
    By elidoperezmd in forum Chrome Troubleshooting
    Replies: 2
    Last Post: 04-29-2009, 03:51 PM
  4. Tab opening in new window
    By amx in forum Chrome Troubleshooting
    Replies: 3
    Last Post: 11-06-2008, 10:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •