2011/8/1 UI Architect <info%[email protected]>: > I need to build an URL blocker script that would block requests to a > given set of URLs. > > With whatever knowledge I have so far, DOM doesn't have any 'change' > event itself; so practically this seems impossible. So I have changed > the problem statement to - "Remove any element from the DOM as soon as > possible after it makes a request to a blocked URL". > > 1) SCRIPT - since changing the src attribute of a SCRIPT element > doesn't make any difference to the DOM, only the new SCRIPT elements > need to be tracked against blocked URLs. > > 2) IFRAME & IMG - both of these types need to be tracked for existing > as well as new elements being added in the DOM against the blocked > URLs. > > The approach I'm thinking of is to start an interval, collect existing > target elements, check the src attributes and remove those elements > from DOM. > > And may be, innerHTML and appendChild methods can be overwritten to do > a pre-check for blocked URLs. > > Can you please suggest better approaches? I need to have a 'best > possible' solution - need not be perfect and 100% full-proof.
The issue with these, that these wont really block the URLs, as they will be loaded. As soon as the item is inserted into the DOM the resource will start to download. The use of a browser plugin or a firewall with URL filtering could do the job. There are several of those for every browser (and some browsers even have them integrated, like Opera) and operating system. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
