javascript - How to specify external js and css for new window opened using window.open -
i trying open content in new tab or new window. code trying
var w = window.open(); $(w.document.head).html("<link rel='stylesheet' href='style.css'/>"); $(w.document.body).html(data);
where data represents html contents placed on new window.the problem when opening new window content appearing, styles missing. while checking tag in head shows undefined. how can display data in new window proper styles?
replace *** html code
var w = window.open(); w.document.write('<html><head><title>test</title>'); w.document.write('<link rel="stylesheet" href="style.css">'); w.document.write('</head><body>'); w.document.write('<p>this new page.</p>'); w.document.write('</body></html>'); w.document.close();
let me know if useful :)
Comments
Post a Comment