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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:42:43+00:00 2026-05-23T21:42:43+00:00

I’ve been messing around with packaged chrome applications today to see how much of

  • 0

I’ve been messing around with packaged chrome applications today to see how much of a website one can manipulate with the code-injection feature.

I’ve been using twitter.com/#!/login as my sandbox because it contains a pretty diverse array of elements.

For some reason, the following code does nothing:

    chrome.tabs.create({url: 'https://twitter.com/#!/login/'}, function (tab) {
        chrome.tabs.executeScript(tab.id, {code: "jQuery('.main').remove();"}, function() {
            console.log('code executed');
        });
    });

It isn’t like I can’t access the page at all, because this does work:

    chrome.tabs.create({url: 'https://twitter.com/#!/login/'}, function (tab) {
        chrome.tabs.executeScript(tab.id, {code: "jQuery('#page-container').remove();"}, function() {
            console.log('code executed');
        });
    });

I’ve loaded jQuery properly in the manifest and have given permissions to all sites as well.

In fact, it seems that I can access any element on the page outside the scope of #page-container.

Using the Chrome dev-tools console to mess with the page, I can easily use jQuery to access every element (although I recognize that this is whatever version the page is natively using).

I noticed something strange in the tag for #page-container:

<div id="page-container" class>...</div>

There is a class attribute with no equals sign or value… could this be blocking me?

Any thoughts on why I can’t get any further into the page with the injected code?

EDIT:
Ok, I found a workaround. Storing the value of #page-container and using setInterval to check for a change takes care of the dynamic problem.

Just to be clear, there isn’t an event handler that can watch for a change in the value of a div, is there? I just feel like using intervals to check for stuff is so old-fashioned these days, even though it is sometimes necessary…

Here’s the workaround code:

    chrome.tabs.create({url: 'https://twitter.com/#!/login/'}, function (tab) {
        chrome.tabs.executeScript(tab.id, {code: "var initial = jQuery('#page-container').html();var interval = setInterval(function(){var final = jQuery('#page-container').html();if(initial !== final){clearInterval(interval);jQuery('.main').remove();}},10);"}, function() {
            console.log('code executed');
        });
    });
  • 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-05-23T21:42:44+00:00Added an answer on May 23, 2026 at 9:42 pm

    There is no class main in the page source, meaning it is getting added to the page dynamically with javascript. You are executing your script right after the tab is created so this div is probably hasn’t been added to the page yet.

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

Sidebar

Related Questions

No related questions found

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.