문제

I have a question. So i found this article by David Walsh - Prepend and Append Files with .htaccess. David shows how to prepend some file usuing .htaccess. I would like to know is there any option to prepend some javascript file into specify of page HTML code, f.e. in a head or just in the bottom of body? Thx for info.

도움이 되었습니까?

해결책

Step 1: Add this in your DOCUMENT_ROOT/.htaccess file:

# Append file to bottom of page
php_value auto_append_file "includes/footer.php"

Step 2: Create DOCUMENT_ROOT/includes/footer.php with this content

<script>
    document.writeln('Its from javascript in footer');
    // put any JS code here
</script>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top