Is it possible to focus on the frame after launch to open the frame being called a second time (Firefox)?

I have a problem with firefox. My research so far tells me that there isn't really a reliable way to handle my problem, but I want to ask just in case.

I have the following javascript / jquery to open a new window triggered by a button click on my page:

alipayTransactionModalTrigger.click(function() {
     NIWindow=window.open("<!--ALIPAY_CONF_REDIRECT_URL-->", "NI payment");
     alipayTransactionModal.dialog("open");
  });

      

In Chrome and Firefox, this opens a new frame and the frame gets focus. It is perfectly. However, if the user leaves this new frame open and goes back to my original page. They can click a button to fire the event again. If this happens, the new frame will reload as it should, but in Firefox, the new frame does NOT pull focus on this update. I'm not sure why it will focus on the initial new load of the frame, but not push focus if the frame is being updated with the same event trigger. I haven't had the guts to test this in IE yet ...

Is this one of those things that you cannot reliably control? Or is there a way to do this? Notice I tried using NIWindow.focus () after the initial window of the open line of code above. Bad luck.

I believe I read a thing or two about the possibilities for using warnings, but I was not sure how to implement the described solution and I read that it was a bit of a hackish solution.

I could always open a new "_blank" window and that would provide focus, but the newly opened frame url uses the parameters based on the parent window. I don't have access to this code, so I don't need to add checks to make sure the data matches until I get a response from this redirect

0


source to share


1 answer


Give each new window a new name. Do you have a reason for reusing the name "NI payment"

?



If your code has dependencies on this window name, you should consider passing a reference to the window (NIWindow) directly instead of the name. Injecting / passing your dependencies instead of relying on the magical super global is the best approach overall.

0


source







All Articles