[英]Redirect to Url after domain
我想通过单击按钮获得重定向,我使用:
<inputtype="submit" onclick="location.href='first';" value="goSomewhere1"/>
<inputtype="submit" onclick="location.href='second';" value="goSomewhere2"/>
如果在页面http://ADDRESS
上单击,但在url
如http://ADDRESS/something
时单击,它将重定向到http://ADDRESS/something/first
怎样才能在ADDRESS
之前获取重定向,但由于该值可能会更改而不能放置此值( ADDRESS
)? (对于此示例,它应该获得http://ADRESS/first
的http://ADDRESS/something/first
)
您要/first
而不是first
。
没有斜杠,这是相对链接。 使用斜杠,绝对是基本URL。
<input type="submit" onclick="location.href='/first'" value="goSomewhere1"/>
<input type="submit" onclick="location.href='/second'" value="goSomewhere2"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.