Print Value Of Javascript In Php
I need to code something like that to print value of javascript in php document.write(top.location.href); ); echo ''.$url.
Solution 1:
No, that's not possible because PHP (server-side) is run before javascript (client side) code. You can do the opposite though. You will have to resort to one of these:
- AJAX
- Hidden Field
- Query String
Though, if you want to read the current page URL, you could use:
$_SERVER['REQUEST_URI']
Solution 2:
Solution 3:
you might not be looking at this the right way. you can see the current path in the url by looking at this variable
echo$_SERVER['REQUEST_URI'];
Update:
Since you want to prevent your site for being under an iframe, you can google frame busting script, it is done entirely in javascript.
Post a Comment for "Print Value Of Javascript In Php"