My website has the same header/sidebar/footer on every page, so I have been importing them using PHP. To do this I forced all html files to be processed through the apache servers PHP handler via htaccess. I have come to understand that is not necessarily the best thing to do and so found out how to do everything I need using simple JavaScript. I also store a variable in the initial page that then gets used in the imported html.
Questions: By switching from:
<?php include "_header.html";?>
to
<script type="text/javascript" src="_header.js"></script>
I am noticing that the "view source" shows the header.js link, whereas the PHP method will show the source as if the html had been there all along. Will search engines recognize the html in the JavaScript just as they would when loaded with PHP?
I understand it is bad practice to alter the page contents -after- it is downloaded, but this doesn't fall into that category does it? That would detail things like after a wait function, or after user interaction, correct?
Are there any other foreseeable downfalls to switching to JavaScript and turning off the forced PHP processing?
_header.html
and_header.js
files. I would think that that alone would be enough to dissuade most from using the JavaScript approach. (?)