Is it possible to import css stylesheets to test.php
head after redirect page to test.php after click on a href link from index
page using Javascript? If so, how can it be done?
problem is that styles.css
not working or display in test.php
page?
i have code like this:
Index Page
<a id="some_id" class="optional_has_click">Click Me</a>
Jquery
<script type="text/javascript">
$(document).ready(function(){
$("#some_id").click(function(){
// add dynamically css file from external link and display to head
window.location.href = 'test.php';
var cssId = 'styles';
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.id = cssId;
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'http://example.com/styles.css';
link.media = 'all';
head.appendChild(link);
document.write("<style>#jstree-marker-line,
#preloader{ background:none !important}</style>");
});
});
</script>
test page
<div id="container">
<p>test</p>
</div>