admin管理员组文章数量:1317898
I am trying to use window.open()
to pass along some arguments to another page.
I want the page to be
myPage.html?img=1.jpg
Where once on that page I will use javascript to get the arg and show the image.
However I cannot figure out how to do this with window.open() cause it says the pages does not exist which I can understand.
window.open('myPage.html?img=1.jpg','_blank')
Hope this makes sense and I don't even know if it is possible.
I am trying to use window.open()
to pass along some arguments to another page.
I want the page to be
myPage.html?img=1.jpg
Where once on that page I will use javascript to get the arg and show the image.
However I cannot figure out how to do this with window.open() cause it says the pages does not exist which I can understand.
window.open('myPage.html?img=1.jpg','_blank')
Hope this makes sense and I don't even know if it is possible.
Share Improve this question asked Jul 10, 2011 at 18:29 jamesjames 2,6639 gold badges47 silver badges72 bronze badges 4- what result did u get with your example? did it work? – Ibu Commented Jul 10, 2011 at 18:31
- 2 If you're getting a 404, then myPage.html must actually not exist! Either that, or due some permissions issues, it can't appear. Simply go to myPage.html in your browser and see if you can load it. I'm willing to bet that you can't. – Brad Commented Jul 10, 2011 at 18:32
- Do you mean a new browser window is openned, but it does not display the page ? If so, is the URL in the new browser window right ? Or it not what you expect ? – phtrivier Commented Jul 10, 2011 at 18:37
- Yeah silly I had spelled it wrong. – james Commented Jul 10, 2011 at 18:38
1 Answer
Reset to default 6myPage.html should exist, and check the docs on window.open
to pass vars:
var variable = "lol";
var w = window.open("http://example.");
w.variable = variable;
or yopu can visit the opeing window:
var variable = window.opener.variable;
本文标签: Javascript windowopen() passing argsStack Overflow
版权声明:本文标题:Javascript window.open() passing args - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742018562a2414234.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论