开发者

Js : open new window and work with it

is possible to open new window ( with external url ) with javascript or jquery and check if in that window was submited a form

something like : window.open(....) then : if ( POST in new window ) { document.writ开发者_JAVA技巧e('in new window was submited a form ' ); } ..

Thanks in advance


If you are guaranteed to have javascript available, you might try a modal popup within the same page.

You tagged your question jQuery so you might want to look at some jQuery popup modal dialogs plugins.

Being in the same page, you can control wether the form has been submitted or not.


You can open the window using such code:

<script type="text/javascript">
var oWindow = 0;
function OpenWin(sURL) {
    oWindow = window.open(sURL, "_blank");
}
</script>

This will open the window and save reference in global variable.

If the new page is in your own domain and the form submits to different page, you can check the oWindow.location.href in timer e.g. every half a second, and if the location match the form action you can assume it was submitted.

If the new page is in your domain you can also hook into the form onsubmit, using jQuery is the most simple way - can you use it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜