Hey folks–
I’d like to create what looks like a link on a page. But the link will
actually submit a form to another website to perform a search.
I’m currently doing something like:
form_tag(“http://www.othersite.com”, :name => “link_form”) +
hidden_field_tag(“one_param”, “value1”) +
hidden_field_tag(“two_param”, “search text”) +
end_form_tag() +
link_to_function(“Search text”, “document.link_form.submit();”)
This works just fine on Firefox/Windows when I click with the left mouse
button.
However, I often click with the middle mouse button to open the page up
in another tab. When I do that with this type of link, it just opens a
copy of the current page in the new tab – i.e., it doesn’t submit the
form.
This appears to be a common problem (after googling a bit), but I was
wondering if there’s a better Javascript/RoR way to manage a solution.
Any suggestions?