In my JavaScript file I've if statement and some code inside it. And I'm trying to use super global variable inside js function.
Here is the PHP code embedded inside JavaScript function:
if(typeof window.history.pushState == 'function') {
window.history.pushState({}, "Hide", '<?php echo $_SERVER['PHP_SELF'];?>');
}
$_SERVER['PHP_SELF']
variable stands for 3-parametr of js function.
One more thing: When I write this code inside my somefile.php it's working fine. But I'm gonna put this partition of code inside external js file and include it. How can I achieve this?