admin管理员组文章数量:1023803
is there a possibility to open a new window with JavaScript and wait with jQuery until the new page has finished loading?
I tried the following, but it did not work:
var win = window.open(url,'',windowSpec);
$(win.window).load(
function () {
alert('Finished loading');
}
);
is there a possibility to open a new window with JavaScript and wait with jQuery until the new page has finished loading?
I tried the following, but it did not work:
var win = window.open(url,'',windowSpec);
$(win.window).load(
function () {
alert('Finished loading');
}
);
Share
Improve this question
edited Dec 19, 2014 at 17:25
APerson
8,4308 gold badges38 silver badges49 bronze badges
asked Sep 20, 2012 at 11:53
JanusJanus
3091 gold badge5 silver badges18 bronze badges
4
- 3 is the url in the new window on the same domain as the calling script? – Gabriele Petrioli Commented Sep 20, 2012 at 11:57
- Yes, it's all on the same server. – Janus Commented Sep 20, 2012 at 12:05
- Can you edit the page loading in the popup? so to insert some javascript in it? – Nelson Benítez León Commented Sep 20, 2012 at 12:09
-
I tried it in the meantime and tried to access the second window with the following
$(win.window).load
and for the finishing of the loading. But it does not work. – Janus Commented Sep 20, 2012 at 12:12
1 Answer
Reset to default 5Since the opened url is on the same server, it means that the two windows can municate.
Add on the page that opens in the window
$(window).load(function() {
var opener = window.opener || window.dialogArguments;
if (opener) {
opener.yourmethod();
}
});
and on the page that initiates the window.open
mand use
function yourmethod(){
alert('Finished loading');
}
Demo at http://jsfiddle/nmXdc/1
(the window that opens from the click is at http://jsfiddle/FPcMk/1/)
is there a possibility to open a new window with JavaScript and wait with jQuery until the new page has finished loading?
I tried the following, but it did not work:
var win = window.open(url,'',windowSpec);
$(win.window).load(
function () {
alert('Finished loading');
}
);
is there a possibility to open a new window with JavaScript and wait with jQuery until the new page has finished loading?
I tried the following, but it did not work:
var win = window.open(url,'',windowSpec);
$(win.window).load(
function () {
alert('Finished loading');
}
);
Share
Improve this question
edited Dec 19, 2014 at 17:25
APerson
8,4308 gold badges38 silver badges49 bronze badges
asked Sep 20, 2012 at 11:53
JanusJanus
3091 gold badge5 silver badges18 bronze badges
4
- 3 is the url in the new window on the same domain as the calling script? – Gabriele Petrioli Commented Sep 20, 2012 at 11:57
- Yes, it's all on the same server. – Janus Commented Sep 20, 2012 at 12:05
- Can you edit the page loading in the popup? so to insert some javascript in it? – Nelson Benítez León Commented Sep 20, 2012 at 12:09
-
I tried it in the meantime and tried to access the second window with the following
$(win.window).load
and for the finishing of the loading. But it does not work. – Janus Commented Sep 20, 2012 at 12:12
1 Answer
Reset to default 5Since the opened url is on the same server, it means that the two windows can municate.
Add on the page that opens in the window
$(window).load(function() {
var opener = window.opener || window.dialogArguments;
if (opener) {
opener.yourmethod();
}
});
and on the page that initiates the window.open
mand use
function yourmethod(){
alert('Finished loading');
}
Demo at http://jsfiddle/nmXdc/1
(the window that opens from the click is at http://jsfiddle/FPcMk/1/)
本文标签: jqueryWaiting for another page to load in JavaScriptStack Overflow
版权声明:本文标题:jquery - Waiting for another page to load in JavaScript - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745604708a2158661.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论