Alain Ravet
2007-Oct-23 16:22 UTC
page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
Hi all, In an AJAX action, I want to open a new window. problem: the code below does not work : I see the 2 alerts, but ''window.open'' does not open a new window. controller : ------------ def test1 render(:update){ |page| page << "alert(''before'')" page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT page << "alert(''after'')" } end view : ------ <%= link_to_remote "open a new window with RJS", :url => {:action => ''test1''} %> I''m stuck here. Any idea what''s happening? Alain --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Roelofs
2007-Oct-23 16:27 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
Go get Firebug: http://www.getfirebug.com/ If you''re still stuck, post what the resulting error is. Jason On 10/23/07, Alain Ravet <alain.ravet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi all, > > In an AJAX action, I want to open a new window. > problem: the code below does not work : I see the 2 alerts, but > ''window.open'' does not open a new window. > > > controller : > ------------ > def test1 > render(:update){ |page| > page << "alert(''before'')" > page << "window.open(''http://www.google.com'');" <<--- HAS NO > EFFECT > page << "alert(''after'')" > } > end > > view : > ------ > <%= link_to_remote "open a new window with RJS", :url => {:action => > ''test1''} %> > > > I''m stuck here. Any idea what''s happening? > > Alain > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bob Showalter
2007-Oct-23 16:42 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
On 10/23/07, Alain Ravet <alain.ravet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all, > > In an AJAX action, I want to open a new window. > problem: the code below does not work : I see the 2 alerts, but > ''window.open'' does not open a new window.Ditto on Firebug. Probably a popup blocker is preventing the window from opening. I''m not sure how to work around that. Try disabling your popup blocker to verify that is the problem. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Hall
2007-Oct-23 16:44 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
have you tried: page.call ''window.open'', ''http://www.google.com'' On 10/23/07, Alain Ravet <alain.ravet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all, > > In an AJAX action, I want to open a new window. > problem: the code below does not work : I see the 2 alerts, but > ''window.open'' does not open a new window. > > > controller : > ------------ > def test1 > render(:update){ |page| > page << "alert(''before'')" > page << "window.open(''http://www.google.com'');" <<--- HAS NO > EFFECT > page << "alert(''after'')" > } > end > > view : > ------ > <%= link_to_remote "open a new window with RJS", :url => {:action => > ''test1''} %> > > > I''m stuck here. Any idea what''s happening? > > Alain > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Alain Ravet
2007-Oct-23 19:40 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
> Probably a popup blocker is preventing the window from opening.That was it, not that it makes sense : the Firefox popup-blocker will * allow (open) <%= link_to "open a new window", root_path, :target => 'child2' %> * but not render(:update){ |page| page << "window.open('#{root_path}');" } 2� : I fear a double "NO", but I'll ask anyway : is there * another javascript way to _open_ a window that would go through the popup blocker, or * a way to _detect_ (even indirectly) that the client's browser has a popup blocker on? Alain On 10/23/07, Bob Showalter <showaltb@gmail.com> wrote:> > On 10/23/07, Alain Ravet <alain.ravet@gmail.com> wrote: > > > > Hi all, > > > > In an AJAX action, I want to open a new window. > > problem: the code below does not work : I see the 2 alerts, but > > 'window.open' does not open a new window. > > Ditto on Firebug. > > Probably a popup blocker is preventing the window from opening. I'm > not sure how to work around that. Try disabling your popup blocker to > verify that is the problem. > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Graff
2007-Oct-23 19:48 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
A quick Google resulted in this: http://www.visitor-stats.com/articles/detect-popup-blocker.php Looks like it might work to detect the blocker. Note that their javascript is sort of... lame. The trick of opening a window and seeing if it is set makes sense, but they always close the window''s object, which will likely fail. You probably want to move that into the ''if the window opened'' code only. If you are doing this trick, I''d highly recommend only doing it once then storing it on the session or something. Having a small window pop up on every page hit will likely drive your users insane, and having the pop-up window thing appear constantly will likely do the same. --Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Alain Ravet
2007-Oct-23 20:49 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
> http://www.visitor-stats.com/articles/detect-popup-blocker.phpThanks Michael. There''s a much simpler way actually : page << "if (confirm(''#{msg}'') ) {" page << " new_win=window.open(''#{root_path}'');" page << " if (new_win==null) {alert(''Please disable your popup blocker'');}" page << "}" Alain On 10/23/07, Michael Graff <skan.gryphon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > A quick Google resulted in this: > > http://www.visitor-stats.com/articles/detect-popup-blocker.php > > Looks like it might work to detect the blocker. > > Note that their javascript is sort of... lame. The trick of opening a > window and seeing if it is set makes sense, but they always close the > window''s object, which will likely fail. You probably want to move > that into the ''if the window opened'' code only. > > If you are doing this trick, I''d highly recommend only doing it once > then storing it on the session or something. Having a small window > pop up on every page hit will likely drive your users insane, and > having the pop-up window thing appear constantly will likely do the > same. > > --Michael--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pablo Castellazzi
2007-Oct-24 21:45 UTC
Re: page << "window.open(''http://www.google.com'');" <<--- HAS NO EFFECT
Instead of a real browser window, try a javascript one, like this http://www.stickmanlabs.com/lightwindow On Oct 23, 2:40 pm, "Alain Ravet" <alain.ra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Probably a popup blocker is preventing the window from opening. > > That was it, not that it makes sense : the Firefox popup-blocker will > > * allow (open) > > <%= link_to "open a new window", root_path, :target => ''child2'' %> > > * but not > > render(:update){ |page| > page << "window.open(''#{root_path}'');" > } > > 2? : > I fear a double "NO", but I''ll ask anyway : is there > * another javascript way to _open_ a window that would go through the > popup blocker, or > * a way to _detect_ (even indirectly) that the client''s browser has a > popup blocker on? > > Alain > > On 10/23/07, Bob Showalter <showa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On 10/23/07, Alain Ravet <alain.ra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi all, > > > > In an AJAX action, I want to open a new window. > > > problem: the code below does not work : I see the 2 alerts, but > > > ''window.open'' does not open a new window. > > > Ditto on Firebug. > > > Probably a popup blocker is preventing the window from opening. I''m > > not sure how to work around that. Try disabling your popup blocker to > > verify that is the problem.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---