html或者js重定向到新的url并且referer为重定向前的页面要怎么写?需要详细代码
HTML重定向:
<meta http-equiv="refresh" content="0;url=new_url" />
JS重定向:
window.location.replace("new_url");
其中,new_url为要重定向的URL。
如果需要在重定向时保留referer信息,可以在URL中添加referer参数,例如:
<meta http-equiv="refresh" content="0;url=new_url?referer=old_url" />
window.location.replace("new_url?referer=old_url");
其中,old_url为重定向前的页面URL。在重定向后的页面中可以通过获取URL中的referer参数来获取重定向前的页面URL。
原文地址: https://www.cveoy.top/t/topic/bTei 著作权归作者所有。请勿转载和采集!