Reputation: 1087
I am creating a popup from javascript with window.open, My popup link is some 3rd party site link. I want to override some css classes for loading popup content.
Is it possible?
I tried with below code, but it is not working.
e = window.open('external-url', 'test window', options)
var head = e.document.getElementsByTagName('head')[0];
var link = e.document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css url hosted on my site';
link.media = 'all';
head.appendChild(link);
Upvotes: 2
Views: 606
Reputation: 43
You may implement in <iframe>
tags. Check this example
http://jsfiddle.net/wxasfymL/3/
Upvotes: 0
Reputation: 2009
No you cannot edit an external site you have opened, that would be a huge security issue, see Same-origin policy. You can however set the height, width, location on the screen, scrollbars visibility and some other properties for the opened window, see Window.open()
Upvotes: 4