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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:40:38+00:00 2026-05-28T03:40:38+00:00

I am trying to modify table’s insertRow function from Chrome extension. oldInsRowFunc = document.getElementById(id).insertRow;

  • 0

I am trying to modify table’s insertRow function from Chrome extension.

oldInsRowFunc = document.getElementById(id).insertRow;
document.getElementById(id).insertRow = fakeInsertRow;
// .......
function fakeInsertRow (ind) {
    alert("fakeInsertRow called");
}

But when it’s called , instead of fakeInsertRow the native function is being invoked.
In other case, if I lunch the same code in javascript console – everything works fine.

  • 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-28T03:40:39+00:00Added an answer on May 28, 2026 at 3:40 am

    The reason this does not work is because the JavaScript that is added by a Chrome extension (typically in a content-script) is executed in its own sandbox that does not have access to the JavaScript environment that the page is loaded in.

    Here are the limitations of JavaScript that come from a Chrome Extension:

    Here are some examples of what content scripts can do:
       * Find unlinked URLs in web pages and convert them into hyperlinks
       * Increase the font size to make text more legible
       * Find and process microformat data in the DOM
    
    However, content scripts have some limitations. They cannot:
       * Use chrome.* APIs (except for parts of chrome.extension)
       * Use variables or functions defined by their extension's pages
       * Use variables or functions defined by web pages or by other content scripts
    

    If your goal is to truly wrap/override a native JavaScript/DOM access method (yikes, seems bad), then one way to execute JavaScript in the context of the page is to create an externally hosted JavaScript file, and then use the Chrome Extension to add a script element to the page’s DOM that refers to the externally hosted file. The JavaScript that is inserted in this manner will run in the pages JavaScript environment (this means it will not be available to the Chrome Extension).

    The Chrome Extension JavaScript would be something like:

    document.body.appendChild(document.createElement("script")).src = "http://externally/hosted/javascript.js";
    

    Then the JavaScript code in the file located at http://externally/hosted/javascript.js could be the code you have above.

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

Sidebar

Related Questions

I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but
I am trying to modify the amcap, an application from Windows SDK's example to
Pretty new to sqlite (and sql). Trying to modify one table using another. create
im trying to make an trigger that updates a table when i modify another
I'm trying to replace some table elements while clicking the modify link, actually it
I'm trying to modify a table inside my PostgreSQL database, but it says there
I’m trying to modify a table to make its primary key column AUTO_INCREMENT after
I am trying to create a CSV file from a dynamically generated table.I have
I am trying to modify the size of a column in a table, however
I am trying to calculate the median from a table with various types of

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.