# Link\_to popup problems

**URL:** <https://www.ruby-forum.com/t/link-to-popup-problems/104722>\
**Category:** Rails\
**Created:** [May 21, 2007, 9:29pm UTC](https://www.ruby-forum.com/t/link-to-popup-problems/104722 "2007-05-21T21:29:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [May 21, 2007, 9:29pm UTC](https://www.ruby-forum.com/t/link-to-popup-problems/104722/1 "2007-05-21T21:29:04Z")

</div>

so, I have a strange problem with popups using link\_to and i’m not sure  
what to look for.

My problem:  
When I click the link it pops open a new window. When using internet  
explorer 6 or 7 _sometimes_ it will open the popup window AND open in  
the same window. I tested it in Opera, FireFox, Safari and they all work  
just fine, only internet exploder it will do this. The main issue is  
that it doesn’t always do it, it’s intermittent.

My code:

\<%= link\_to(‘Seating Chart’, { :controller =\> ‘pages’, :action =\>  
‘seating\_chart’, :id =\> @show }, :popup =\> true) %\>

Any ideas?

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [February 29, 2008, 9:32pm UTC](https://www.ruby-forum.com/t/link-to-popup-problems/104722/2 "2008-02-29T21:32:44Z")

</div>

Jeremy W. wrote:

> so, I have a strange problem with popups using link\_to and i’m not sure  
> what to look for.
> 
> My problem:  
> When I click the link it pops open a new window. When using internet  
> explorer 6 or 7 _sometimes_ it will open the popup window AND open in  
> the same window. I tested it in Opera, FireFox, Safari and they all work  
> just fine, only internet exploder it will do this. The main issue is  
> that it doesn’t always do it, it’s intermittent.
> 
> My code:
> 
> \<%= link\_to(‘Seating Chart’, { :controller =\> ‘pages’, :action =\>  
> ‘seating\_chart’, :id =\> @show }, :popup =\> true) %\>
> 
> Any ideas?

Hi there,  
Did you resolve this issue? I am having similar issue.

Thanks

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [May 18, 2008, 6:54pm UTC](https://www.ruby-forum.com/t/link-to-popup-problems/104722/3 "2008-05-18T18:54:05Z")

</div>

Hi,

> \<%= link\_to(‘Seating Chart’, { :controller =\> ‘pages’, :action =\>  
> ‘seating\_chart’, :id =\> @show }, :popup =\> true) %\>
> 
> Any ideas?  
> Well, in fact I dont have a real solution to your specific problem,  
> but some hints:  
> If you look at the generated html/js-code you should see a “return  
> false” as last call. This prevents the browser from following the href-  
> Link. But if there is any problem within the javascript-Code, the  
> return false is not executed anymore and thus, the browser jumps to  
> the href, even if the opening of the popup opens. But how can there be  
> an error within the javascript when it is fully generated by rails,  
> one might ask.

The solution might be found within project-specific javascript-code.  
In my case I had a jquery-function which appended to all links and  
which had an error. So every link produces an js-Error. Unfortunately,  
these errors are hard to track - even with firebug- since the page is  
newly loaded all js-Errors are reseted. One way which sometimes helps  
is to modify the onclick-call via firebug, so that before the return-  
call an alert(“hi!”) is called. So if you see no alert that is a  
strong indicator that there is anything wrong with your js.

Another hint: just disable you js-library temporarily so that you can  
see if the error occures nevertheless.

Hope this helped you a bit.

Greetings,  
Yoche2001

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [May 18, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/link-to-popup-problems/104722/4 "2008-05-18T19:05:49Z")

</div>

Hi,

just a hint: try to disable temporarily your used js-library. I once  
had an error in an jquery-event (added the click-Event) twice so that  
each link with a onclick-Handler produced an js-Error and the “return  
false” was never reached. Unfortunately these errors are hard to  
track, even with firebug, since the main-page is newly loaded and so  
the js-error-log is cleared.

Greetings,  
Yoche2001
