I am using the following javascript to open another window and I want to check if that window is actually open, but then I want it to call a “pause()” function if the window is not open. I have no clue how to do this even after 3 days of researching, can anybody guide me with this?
The javascript to open the window:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script type="text/javascript">
var windowSizeArray = ["width=300,height=300",
"width=200,height=400,scrollbars=yes"];
$(document).ready(function () {
$('#newWindow').click();
window.open($('#newWindow').attr('href'), 'window name', 'window settings')
$('.newWindow').click(function (event) {
var url = $(this).attr("href");
var windowName = "popUp"; //$(this).attr("name");
var windowSize = windowSizeArray[$(this).attr("rel")];
window.open(url, windowName, windowSize);
event.preventDefault();
});
});
</script>
If that window is not open I want it to call a pause function:
<a href="javascript:void(0);" onclick="pause();"><img name="b1" src="system/modules/surf/stop.png" border="0" alt="Pause" title="Pause" style="position:absolute;top:28px;margin-left:5px"></a>
The function
window.open()returns a handle to your newly created window, which has aclosedproperty. This property is true if the new window has been closed:If you need to monitor the status of the window continuously, use
window.setInterval():