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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -