In a client side script (JavaScript, HTML etc.) how do I make the page redirect to a link specified in the address bar when a function had been called.

Example: Address bar says: Example.com/(code containing redirect link)

When a certain function is called, for example, it will redirect to a page specified in the "(code containing redirect link)"

Here is a question similar (it isn't client side, like what I need): how to get the value from address bar entered by client?

Thanks in advance.

有帮助吗?

解决方案

I am not sure why you would want to do that but here goes:

//Sets location for current window       
window.location = window.location.pathname; // Get the string after the /
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top