javascript - Userscript in inner #document elements -


this question has answer here:

i trying write tampermonkey script appends html body, reason, html dialog appears in ads. google chrome's inspect element shows this:

#document <!doctype html> <html> <body> <!-- body tag --> ... </body> </html> 

as can see, there body tag, dialog appears in it, too. there way target main <body> tag, , not inside #document tag?

what happening because @match quite greedy, runs on html documents on page. if want run on root page, can check if window "top" window.

if (window !== window.top) { // not root, return     return; } 

this may present problem when run on pages framesets, not common practice more, surprised if find problem.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -