I've a html page with a lot of css and javascript tag in its head. I want to print them in a php page as it is. I've tried php echo file_get_contents("html_url");
and fread
function also . The php page loads the html as expected. But the problem is some css code and javascript code does not work.
For example I've a javascript fuction this:
window.addEventListener('load' , openFirstCollapse );
function openFirstCollapse(){
var elem = document.querySelectorAll('.card-link');
elem[0].click();
}
does not work and most of the javascript function does not work. I think the <script src="javascriptfile.js"
tag in the head of the html page is unable to load it through php function.
Can someone tell me what is actually happening here ?
And how can I get rid of it ?