I have two HTML pages. The first contains a link; onclick
of this, the 2nd page is opened. When user tries to click the link again I check if the 2nd page is opened or not; if it is opened I focus, otherwise I open the page. This worked smoothly in both IE and Chrome.
I changed the 2nd page a little bit, having an onload
fucntion which invokes a servlet and reloads the page with the servlet's content.
The problem is, the 2nd page is focusing in google chrome while it is not focusing in
IE after changing?
JS on first page:
var childWindow = null;
var yourLink = '/FirstJSPOne/child.html';
function doIt() {
if (!childWindow) {
childWindow = window.open(yourLink,'childWindow',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
} else {
try {
childWindow.focus();
} catch (e) {
childWindow = window.open(yourLink,'childWindow',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
}
}
}
JS on 2nd page:
function submitForm(){
var formName = document.forms[0];
formName.submit();
}
HTML on 2nd page:
<body onload="submitForm()">
<form id="child" action="SelectBeer.do" method="post">
</form>