Duplicate content page into nested iframe

73 views
Skip to first unread message

D T

unread,
Oct 6, 2022, 1:15:04 AM10/6/22
to Chromium Extensions
General question for the group:

If I navigate to a page say, www.xyz.com and append an iframe to the page, can I inject the iframe with some of the css, script tags, and dom elements from the www.xyz.com page without raising content security policy errors?

Thanks,
DT

wOxxOm

unread,
Oct 6, 2022, 4:21:04 AM10/6/22
to Chromium Extensions, dto...@gmail.com
If the iframe is same-origin (e.g. no `src`) then you can do it easily. If it's cross-origin (like an iframe from web_accessible_resources) you can probably use chrome.declarativeNetRequest.updateDynamicRules (example) to set the  Access-Control-Allow-Origin (and related CORS headers as shown in various examples) for requests inside your iframe identified by the initiatorDomains condition in the example.

D T

unread,
Oct 6, 2022, 7:42:21 PM10/6/22
to Chromium Extensions, wOxxOm, D T
Thanks, will give this a shot.  
Reply all
Reply to author
Forward
0 new messages