Javascript ie vs chrome window.location.href和<;基地>;标签
单击Javascript ie vs chrome window.location.href和<;基地>;标签,javascript,jquery,html,redirect,window.location,Javascript,Jquery,Html,Redirect,Window.location,单击时,我无法使用javascript重定向到其他页面。对于我的网站,我使用标记作为链接的起点 请考虑这个代码: <!doctype html> <html lang="en"><head> <meta charset="utf-8"/> <title>Login</title> <base href="http://www.mysite.com/MyWebsite/manage/" /> 特别提及 v
时,我无法使用javascript重定向到其他页面。对于我的网站,我使用
标记作为链接的起点
请考虑这个代码:
<!doctype html>
<html lang="en"><head>
<meta charset="utf-8"/>
<title>Login</title>
<base href="http://www.mysite.com/MyWebsite/manage/" />
特别提及
var href = 'alerts/alert.php?id=' + alert_id;
if (href) { window.location.href = href; }
并考虑我在网站上的当前位置已经在名为Alcess的文件夹中,如下: 警报/index.php
我想从index.php转到alert.php 在chrome上,所有操作均按预期进行,即基本hrefhttp://www.mysite.com/MyWebsite/manage/
被连接到警报/alert.php?id=1
,我被相应地重定向
然而在IE中
文件夹警报加倍:警报/alerts/alert.php?id=1
这意味着它不是从基标记获取基URL,而是使用相对路径
有什么想法吗?您可以使用:
document.location.replace();
功能。您将不会重新请求使用基本选项。它将被重定向到同一目录中的页面或子目录
document.location.replace();