# Link\_to\_remote and browser compatibility

**URL:** <https://www.ruby-forum.com/t/link-to-remote-and-browser-compatibility/50338>\
**Category:** Rails\
**Created:** [December 15, 2005, 1:15pm UTC](https://www.ruby-forum.com/t/link-to-remote-and-browser-compatibility/50338 "2005-12-15T13:15:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonas](https://www.ruby-forum.com/u/jonas)\
**Post date:** [December 15, 2005, 1:15pm UTC](https://www.ruby-forum.com/t/link-to-remote-and-browser-compatibility/50338/1 "2005-12-15T13:15:23Z")

</div>

link\_to\_remote generates the javascript: new Ajax.Updater(…). Have I  
missed something or doesn’t this handle browsers with javascript support  
but without XHR support?

What I’d like to do is:

1. If the browser supports XHR, use XHR
2. If the browser supports javascript (and perhaps even if the XHR  
request fails) do a POST via javascript
3. If the browser doesn’t support javascript use POST via a standard  
form

Is that possible?

Thanks in advance,

Jonas Bengtsson

> **[SEO & Sökmotoroptimering - Så fungerar det - And then nothing](https://andthennothing.net)**
>
> SEO, eller sökmotoroptimering, är avgörande för alla företag som vill nå ut till kunder online. Men den överflödiga informationen kan göra att det verkar vara ett mycket komplicerat område, fullt av olika tekniker och idéer. För att göra det enklare...

---

<div class="post-metadata">

**Author:** ![jonas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonas](https://www.ruby-forum.com/u/jonas)\
**Post date:** [December 15, 2005, 1:26pm UTC](https://www.ruby-forum.com/t/link-to-remote-and-browser-compatibility/50338/2 "2005-12-15T13:26:58Z")

</div>

did you include this in your header?

\<%= javascript\_include\_tag ‘prototype’, ‘scriptaculous’ %\>

as well as have those files in your javascripts folder found in the  
public directory?

there is also a url\_for attribute that you can add to your  
link\_to\_remote that will do a post if the browser does not have  
javascript turned on or does not support it.

Andrew

---

<div class="post-metadata">

**Author:** ![jonas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jonas](https://www.ruby-forum.com/u/jonas)\
**Post date:** [December 15, 2005, 4:23pm UTC](https://www.ruby-forum.com/t/link-to-remote-and-browser-compatibility/50338/3 "2005-12-15T16:23:45Z")

</div>

Thanks for your answer Andrew,

Andrew F. wrote:

> did you include this in your header?
> 
> \<%= javascript\_include\_tag ‘prototype’, ‘scriptaculous’ %\>
> 
> as well as have those files in your javascripts folder found in the  
> public directory?

Yes. link\_to\_remote works when I use a browser with XHR support so  
everything is set up correctly.

> there is also a url\_for attribute that you can add to your  
> link\_to\_remote that will do a post if the browser does not have  
> javascript turned on or does not support it.

Do you mean options[‘url’]? Won’t it just do a GET on that url if  
javascript is turned off (I want a POST)? And that still don’t address  
browsers without XHR support.

/Jonas
