Welcome guest, is this your first visit? Create Account now to join.
Results 1 to 2 of 2

This is a discussion on append same html elements to DOM by background script within the Chrome Plugins section, part of the Google Chrome category: ...


  1. #1
    moshe2b is offline Junior Member
    Join Date
    Aug 2011
    Posts
    2

    Default append same html elements to DOM by background script

    Hi,
    I want to append the same html elements to the current TAB document DOM.
    I want these html extended elements to live "forever", so I want to built them once, and append them on every page load by the content script.I was thinking to place the createElement commends at the background page.
    Then for every web page load, I want the content script to communicate with the background script, so it will append them to the current TAB document DOM.
    Is that good practice?My problem is that I donít know how to append html elements to the DOM from the background page.
    Can you please help?

  2. #2
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    I dont think you can add an element to the tabs dom from the background page.Youll either need to use messaging to communicate with the content script or you could use tabs.executeScript to inject a script in the tab (you can then construct it from the background page) but then youll have to monitor the tab for updates and what not.

Similar Threads

  1. Blocking ads and hiding page elements
    By Michael3185 in forum Chrome Plugins
    Replies: 164
    Last Post: 10-29-2015, 12:17 PM
  2. Pass data from background to tab script.
    By irmn in forum Plugins Development
    Replies: 1
    Last Post: 03-25-2011, 04:04 PM
  3. get reference to the document object from background.html
    By itomatik in forum Plugins Development
    Replies: 1
    Last Post: 11-09-2010, 09:04 AM
  4. Need help with Elements please!
    By robgroove in forum Chrome Troubleshooting
    Replies: 0
    Last Post: 05-28-2010, 08:22 PM
  5. Refreshing background.html? localStorage issue
    By bryanosaurus in forum Plugins Development
    Replies: 5
    Last Post: 05-18-2010, 09:49 PM

Posting Permissions

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