JavaScript, window.open, clean url's and Internet Explor
JavaScript, window.open, clean url's and Internet Explorer 10
我在我的网站中使用干净的网址(通过htaccess实现)。它工作得很好。
正如预期的那样,像这样的地址 (http://www.mysite.com/mypage/param1) 表示 (http://www.mysite.com/mypage.php?id=param1)。一切都很好,但是...
在这个页面(mypage.php)中,我有一个运行一些JavaScript的按钮。最后一条指令是:
window.open('otherpage.php?id=x&t=2');
在Firefox和Chrome中,它会打开正确的页面:
http://www.mysite.com/otherpage.php?id=x&t=2
但是IE(我在Windows 8上使用IE10)试图打开一些不同的东西:
http://www.mysite.com/mypage/otherpage.php?id=x&t=2(好像我的页面是一个文件夹)
有谁知道我做错了什么以及我必须做什么才能让IE打开所需的页面?
任何帮助将不胜感激。
谢谢。
在得到一些答案(谢谢大家的及时回复)后,我意识到我应该更具体。页面 mypage.php 不在根文件夹中,otherpage.php 也不在根文件夹中。由于系统的性质,我不能使用绝对路径,所以我需要一个作为相对路径的解决方案(如果可能的话)。
再次感谢。
对于以斜杠结尾的 url,您需要一个前导斜杠(例如/mypage/),当您不包含前导斜杠时,它应该始终相对于您当前的路径名打开
window.open('/otherpage.php?id=x&t=2');
您可以通过相对链接导航到相应的页面。
./ = current directory
../ = one directory higher
因此,如果您的第二个页面位于与当前目录同一级别的另一个目录中,您可以执行以下操作
./../otherdirectory/otherpage.php
如果它在子目录中,请执行如下操作
./subdirectory/otherpage.php
如果它向上两级:
./../../otherpage.php
希望这有帮助
- 视频HTML没有'无法在Internet Explorer 11上工作
- Selenium WebDriver and JavaScript change
- Internet Explorer缺少占位符支持,特别是密码字段
- Internet Explorer中的文本换行错误
- 为什么我在Internet Explorer上看不到html元素
- PHP and Javascript functions
- Javascript Return and if/else
- SetTimeout and clearTimeout in Javascript
- cubism.js and Internet Explorer
- javascript and Internet Explorer 8
- Google Maps API V3 and Internet Explorer
- Chromeless YouTube Video Player and Internet Explorer
- internet explorer and target event
- Error with Internet Explorer and Jquery Ajax
- AJAX and setTimeout on Internet Explorer
- Internet Explorer, ColdFusion and Ajax
- ajaxSubmit and Internet explorer issue
- Internet explorer and removeChild()
- JavaScript, window.open, clean url's and Internet Explor
- Ajax and internet explorer