0

I have an iframe inside a window. I can access all the frames from the top context using the chrome developer tools with the following:

var vn = window.frames['frame_name'];

I can also change between the frames in the developer tools using the following selections: Chrome dev tools

The iframes and the parent window have different domains and can be shown by switching the context and running the command: document.domain;

I want to be able to set the domain of iframe from the parent or using a chrome extension. Can someone help me out here? I have tried to do the following from the parent (to change domain of iframe): window.frames['framename'].domain = 'parent';

However, I get this Error: Cors error

sideshowbarker
  • 62,215
  • 21
  • 143
  • 153
  • The content script of the main page can't do that. You need to make its instance run inside the iframe, see [all_frames](https://developer.chrome.com/extensions/content_scripts#frames) so each instance will run inside each matching iframe where you can access each frame's `window` directly. – wOxxOm Feb 11 '21 at 19:14
  • That worked, Thank you! – Adil Ughratdar Feb 13 '21 at 03:11

0 Answers0