# Auto\_link open new window

**URL:** <https://www.ruby-forum.com/t/auto-link-open-new-window/176749>\
**Category:** Rails\
**Created:** [October 5, 2009, 7:36pm UTC](https://www.ruby-forum.com/t/auto-link-open-new-window/176749 "2009-10-05T19:36:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [October 5, 2009, 7:36pm UTC](https://www.ruby-forum.com/t/auto-link-open-new-window/176749/1 "2009-10-05T19:36:10Z")

</div>

This code is not opening the link in a new window. Any ideas?

\<%= auto\_link(@post, :href\_options =\> { :target =\> ‘\_blank’ }) %\>

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [October 5, 2009, 8:43pm UTC](https://www.ruby-forum.com/t/auto-link-open-new-window/176749/2 "2009-10-05T20:43:59Z")

</div>

Chris H. wrote:

> This code is not opening the link in a new window. Any ideas?
> 
> \<%= auto\_link(@post, :href\_options =\> { :target =\> ‘\_blank’ }) %\>

What does the generated HTML look like?

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [October 5, 2009, 8:48pm UTC](https://www.ruby-forum.com/t/auto-link-open-new-window/176749/3 "2009-10-05T20:48:11Z")

</div>

normal without the target= “\_blank”

On Mon, Oct 5, 2009 at 1:43 PM, Marnen Laibow-Koser \<

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [October 5, 2009, 9:03pm UTC](https://www.ruby-forum.com/t/auto-link-open-new-window/176749/4 "2009-10-05T21:03:24Z")

</div>

2009/10/5 Me [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> This code is not opening the link in a new window. Â Any ideas?
> 
> \<%= auto\_link(@post, :href\_options =\> { :target =\> ‘\_blank’ }) %\>

I have seen suggestions that there is an error in the docs for  
auto\_link and that it should be :html =\> {} rather than :href\_options  
=\> {}. I cannot vouch for the correctness or otherwise of this  
however.

Colin

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [October 5, 2009, 9:10pm UTC](https://www.ruby-forum.com/t/auto-link-open-new-window/176749/5 "2009-10-05T21:10:26Z")

</div>

Ya that worked. Thanks, I should have tried that. DOH!
