leitning Posted May 1, 2012 Share Posted May 1, 2012 I wrote a rather complicated image gallery application that I want to be able to AJAX into other pages. All the code imports fine but I need to append external CSS and JS files to the page in order for it to work. Is it possible to append an external CSS or Javascript file to the head after the initial page has been loaded? In other words to have the following script in the content that is AJAXed in? var extCSS = document.createElement('link'); extCSS.setAttribute('rel', 'stylesheet'); extCSS.setAttribute('type', 'text/css'); extCSS.setAttribute('href', 'test.css'); document.getElementsByTagName('head')[0].appendChild(extCSS); Link to comment https://forums.phpfreaks.com/topic/261883-dynamically-append-external-csjs-after-loading/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.