[Moo] Popup blocked by safari 5.1.x

88 views
Skip to first unread message

Sitthykun LY

unread,
May 16, 2012, 9:58:46 AM5/16/12
to mootools-users
Hi Mootooler,

I have problem with my mootools's statement

document.id("myAhref").addEvent("click", function(event) {
                                        event.stop();
new Request({
                                             async:    false,
                                             method: 'POST',
     data: {'key': 'value'},
     onComplete: function(responseText) {
if (responseText != undefined) {
var newWindow = window.open('http://test.com/example.php');
if (newWindow && !newWindow.closed) {
newWindow.focus();
}
        }
   }
      }).send();
});

It does not work Safari and others are so good, I don't see error.
but in JQuery it work as well.
I don't know what is the problem

$("# myAhref ").click(function(e) {
                                        e.preventDefault();
                                        $.ajax({
                                                url: 'http://test.com/requestData.php',
                                                async:    false,
                                                type: "POST",
                                                data: {'key': 'value'},
                                                success:  function(responseText) {
                                                        if (responseText != undefined) {
                                                                if (responseText != undefined) {
var newWindow = window.open('http://test.com/example.php');
if (newWindow && !newWindow.closed) {
newWindow.focus();
}
                }
                                                        }
                                        });
                                });






Thanks, 
Sitthykun LY


verylastminute

unread,
May 16, 2012, 10:34:18 AM5/16/12
to mootool...@googlegroups.com
Please can you make a fiddle (http://jsfiddle.net) which demonstrates it working with jQuery and a fiddle that demonstrates it not working with MooTools? My initial feeling is that popups are the domain of the browser, and all libraries will fail this operation if the browser prevents it. The fiddles will help to enforce this idea, or provide insight as to why it is invalid.

cp

piotr_cz

unread,
May 17, 2012, 3:25:49 AM5/17/12
to MooTools Users
Instead of opening new window you could load new content to modal
iframe/ ajax content (see http://mootools.net/forge/browse?search=modal)

When you really really need to open new window, you may check if
opening has been successful and if not, assume that it's blocked by
browser and show up a notice to user that popups have to be allowed
for full app functionality.
> > *It does not work Safari and others are so good, I don't see error.*
> > *but in JQuery it work as well.*
> > *I don't know what is the problem*

Sitthykun LY

unread,
May 18, 2012, 12:15:50 PM5/18/12
to mootool...@googlegroups.com
@verylastminute:
for mootools: http://jsfiddle.net/Fp2s2/
for jquery: http://jsfiddle.net/Fp2s2/2/
Both of these are not work on Safari 5.1.3


@piotr
No, I cannot. My project requires Popup Window only. And the users will be confused

Thank you big big

verylastminute

unread,
May 18, 2012, 5:16:06 PM5/18/12
to mootool...@googlegroups.com
Then it's probably the browser blocking popup windows. Use a modal or give up on the idea. Opening new windows is unreliable and obtrusive.

piotr_cz

unread,
May 21, 2012, 5:09:46 AM5/21/12
to MooTools Users
@Sitthykun:
as verylastminute pointed out, most probably this has nothing to do
with Mootools.

You could check if the window opening has been successful and advice
the user to allow it for you app.
if (newWindow === undefined) alert('Please allow popup windows for
this app');

Ask uncle Google or Safari support, For example I've just found:
http://jensarps.de/2009/08/21/safari-and-window-open/ and
http://jensarps.de/2009/10/08/safari-and-window-open-%E2%80%93-how-to-do-it/


@verylastminute:
There might be scenarios, when popup windows are quite helpful:
Imagine an application, where you may want to undock specific widget
to new browser window so user has more control over it using native OS
UI (minimize, move to other desktop/ monitor, resize, adjust opacity
etc). I've played around with this and the result is pretty cool, but
keeping multiple app windows in sync and delegating functionality is..
non-trivial :)


On May 18, 11:16 pm, verylastminute <cgp...@gmail.com> wrote:
> Then it's probably the browser blocking popup windows. Use a modal or give
> up on the idea. Opening new windows is unreliable and obtrusive.
>
>
>
>
>
>
>
> On Friday, May 18, 2012 6:15:50 PM UTC+2, Sitthykun wrote:
>
> > @verylastminute:
> > for mootools:http://jsfiddle.net/Fp2s2/
> > for jquery:http://jsfiddle.net/Fp2s2/2/
> > Both of these are not work on Safari 5.1.3
>
> > @piotr
> > No, I cannot. My project requires Popup Window only. And the users will be
> > confused
>
> > Thank you big big
>
> > On Thu, May 17, 2012 at 2:25 PM, piotr_cz <pkoniec...@hotmail.com> wrote:
>
> >> Instead of opening new window you could load new content to modal
> >> iframe/ ajax content (seehttp://mootools.net/forge/browse?search=modal)
Reply all
Reply to author
Forward
0 new messages