admin管理员组文章数量:1429321
I try to open multiple browser windows using javascript and the window.open() function. I want to pass a parameter through the query string to my new window like this:
window.open('.aspx?fooparm=1', '_blank');
This opens a new window with the correct address in the address bar but the browser displays a 404-not found. However, if I press enter in this new window, the page loads up correctly.
With a bit of trial and error, I found that using window.open without query string parameters works perfectly:
window.open('.aspx', '_blank');
Is there a limitation I should know about window.open and query string parameters? Is there another way to pass parameters to a new page in a new window?
Thank you very much in advance for your insight.
(Note: This script is generated server-side in C# and injected into the page using Ajax's ScriptManager.RegisterStartupScript.)
I try to open multiple browser windows using javascript and the window.open() function. I want to pass a parameter through the query string to my new window like this:
window.open('http://www.myfoo./foopage.aspx?fooparm=1', '_blank');
This opens a new window with the correct address in the address bar but the browser displays a 404-not found. However, if I press enter in this new window, the page loads up correctly.
With a bit of trial and error, I found that using window.open without query string parameters works perfectly:
window.open('http://www.myfoo./foopage.aspx', '_blank');
Is there a limitation I should know about window.open and query string parameters? Is there another way to pass parameters to a new page in a new window?
Thank you very much in advance for your insight.
(Note: This script is generated server-side in C# and injected into the page using Ajax's ScriptManager.RegisterStartupScript.)
Share Improve this question asked Aug 4, 2009 at 12:10 Danny T.Danny T. 1,14010 silver badges23 bronze badges3 Answers
Reset to default 4I found why this morning:
In web.config, under globalization, the responseEncoding was set to "cp037". I changed it to "ISO-8859-15" and my windows are popping up correctly.
<globalization fileEncoding="ISO-8859-15" requestEncoding="ISO-8859-15" responseEncoding="ISO-8859-15" culture="auto" uiCulture="auto"/>
One thing for sure: the limitation is not tied to window.open() pre se. My server runs mod_perl, and I use GET requests in window.open() frequently.
try with
window.open("javascript:window.location='http://www.myfoo./foopage.aspx?fooparm=1'", "_blank");
本文标签: javascriptQuery string parameters do not seem to work with windowopenStack Overflow
版权声明:本文标题:javascript - Query string parameters do not seem to work with window.open - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745421306a2657911.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论