Reputation: 219
I am wondering how to check for a current url with php. What I am trying to achieve is to load a .js file when a certain url is active. So lets say in the url is: mydomain.nl. In thast case there should a .js be loaded. But if the url is mydomain.nl/pages , the .js should not be loaded. How can I check this?
Upvotes: 2
Views: 38
Reputation: 6661
Use PHP_SELF
:-
<?php
if(!isset($_SERVER['PHP_SELF'])){
?>
<script>
//Load JS file
</script>
<?php
}
?>
Upvotes: 2