I want to pass a URL to another domain through javascript appending iframe, when exit the iframe, the other domain can return the user to previous page on my site. If use php to submit the exit_url, it is
$exit_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "&request=example"";
I would like to learn how to convert this string to use in javascript. Thanks!
You get the equivalent of $_SERVER['REQUEST_URI']
by appending location.pathname
and location.search
:
var request_uri = location.pathname + location.search;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With