I am writing text to a page using document.write for the Chrome extension, but the corresponding custom CSS is not applied:
<!DOCTYPE html> <html> <head> <title>TITLE GOES HERE</title> <link rel="stylesheet" href="css/popup.css" type="text/css" /> </head> <body> <script type="text/javascript"> ... function showFolder(folder) { console.debug('FOLDER: '+folder.title); document.write('<p>'+folder.title+'<br></p>'); } </script> </body> </html>
CSS is simple, just for debugging:
p { color: red; }
I can make it work if I put the stylesheet link inside the showFolder function, but this may not be the right way to do this. I learn jscript / CSS on the fly, so the answer is probably something fixed. Is the problem in jscript, CSS or both?
source share