[Proto-Scripty] Re: window.open on ajax response
The browser probably blocks the popup because it is not opened by a direct action of the user. What you may try is: - On the click event: - Open the window on a blanc (or temporary) url - Launch the Ajax request - On the Ajax's onComplete: - Change the url of the previously opened window Eric On Jul 13, 11:15 am, ColinFine colin.f...@pace.com wrote: On Jul 12, 5:31 am, Hari hariharanwebm...@gmail.com wrote: But even this doesn't help since function call happens by a call back and not user action. So the browser popup blocker click in. One way i could think is make the Ajax call synchronous. But I think its not a great idea to make the Ajax call synchronous... I don't see how this would make any difference. What you have not made clear are what are the circumstances in which your browser blocks popups. Without knowing that it is hard to suggest a solution. It seems unlikely to me that it makes a difference whether the window is opened from a callback or not, but I don't know. Colin -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: window.open on ajax response
Hi, But even this doesn't help since function call happens by a call back and not user action. So the browser popup blocker click in. One way i could think is make the Ajax call synchronous. But I think its not a great idea to make the Ajax call synchronous... I don't see how this would make any difference. It makes a difference because most browsers' popup blocking will allow a window to be opened by code running during an event handler for a user-initiated event (like a click), but block windows opened by code running at other times (like an Ajax callback). So the synchronous version would still be running during the event handler, so _may_ work. But then the OP would have to make a synchronous ajax call, which is a Bad Thing. :-) -- T.J. On Jul 13, 10:15 am, ColinFine colin.f...@pace.com wrote: On Jul 12, 5:31 am, Hari hariharanwebm...@gmail.com wrote: But even this doesn't help since function call happens by a call back and not user action. So the browser popup blocker click in. One way i could think is make the Ajax call synchronous. But I think its not a great idea to make the Ajax call synchronous... I don't see how this would make any difference. What you have not made clear are what are the circumstances in which your browser blocks popups. Without knowing that it is hard to suggest a solution. It seems unlikely to me that it makes a difference whether the window is opened from a callback or not, but I don't know. Colin -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: window.open on ajax response
On Jul 12, 5:31 am, Hari hariharanwebm...@gmail.com wrote: But even this doesn't help since function call happens by a call back and not user action. So the browser popup blocker click in. One way i could think is make the Ajax call synchronous. But I think its not a great idea to make the Ajax call synchronous... I don't see how this would make any difference. What you have not made clear are what are the circumstances in which your browser blocks popups. Without knowing that it is hard to suggest a solution. It seems unlikely to me that it makes a difference whether the window is opened from a callback or not, but I don't know. Colin -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: window.open on ajax response
But even this doesn't help since function call happens by a call back and not user action. So the browser popup blocker click in. One way i could think is make the Ajax call synchronous. But I think its not a great idea to make the Ajax call synchronous... Regards, Hari On Jul 11, 7:29 am, ncubica ncub...@gmail.com wrote: I guess one easy option is to call a outside function like new Ajax.Request('someURL', { onSuccess: function(response) { var success = response.responseText; success == true ? openPopup(http://google.com;) : openPopup(http://yahoo.com;); } }); function openPopup(site){ window.open(site); } mmm but what I don't know is if the browser is going to keep blocking the new window... the only difference with this is the scope. but that should be work... Nahum On Jul 10, 7:49 am, Hari hariharanwebm...@gmail.com wrote: Hi, I have hyperlink. When a user clicks on it, i would make a ajax call to get the location where a new browser window should be opened. for example: new Ajax.Request('someURL', { onSuccess: function(response) { var success = response.responseText; success == true ? window.open(http://google.com;) : window.open(http://yahoo.com;); } }); But problem is the window.open is called as part of onSuccess callback. So the browser popup blocker blocks the call. How can I get around this problem and want the popup to open. Thanks, Hari -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: window.open on ajax response
I guess one easy option is to call a outside function like new Ajax.Request('someURL', { onSuccess: function(response) { var success = response.responseText; success == true ? openPopup(http://google.com;) : openPopup(http://yahoo.com;); } }); function openPopup(site){ window.open(site); } mmm but what I don't know is if the browser is going to keep blocking the new window... the only difference with this is the scope. but that should be work... Nahum On Jul 10, 7:49 am, Hari hariharanwebm...@gmail.com wrote: Hi, I have hyperlink. When a user clicks on it, i would make a ajax call to get the location where a new browser window should be opened. for example: new Ajax.Request('someURL', { onSuccess: function(response) { var success = response.responseText; success == true ? window.open(http://google.com;) : window.open(http://yahoo.com;); } }); But problem is the window.open is called as part of onSuccess callback. So the browser popup blocker blocks the call. How can I get around this problem and want the popup to open. Thanks, Hari -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.