Forum: Rails Spinoffs (closed, excessive spam) RJS on javascript disabled browsers

C6d37b088a99ad744492e4e16b857c86?d=identicon&s=25 skilled_dreamer (Guest)
on 2008-07-08 10:25
(Received via mailing list)
Good day,

I would like to ask on how to solve the problem regarding RJS on a
javascritpt disabled browsers. because when i disable the javascript
on my firefox and click on the submit button what i get is the
javascript.

Is there a way that if javascript is disabled the user will be
redirected to the erb file?

Thank you
82476266af9d460415d8f1fc16bb54ed?d=identicon&s=25 Jarkko Laine (jarkko)
on 2008-07-08 10:46
(Received via mailing list)
Attachment: smime.p7s (2 KB)
On 8.7.2008, at 11.24, skilled_dreamer wrote:

>
> Good day,
>
> I would like to ask on how to solve the problem regarding RJS on a
> javascritpt disabled browsers. because when i disable the javascript
> on my firefox and click on the submit button what i get is the
> javascript.
>
> Is there a way that if javascript is disabled the user will be
> redirected to the erb file?

I don't think you should get the RJS in return if the request is sent
from a non-JS context, given that you have an existing normal html
template for that action. If you get the RJS back, the action either
for some reason thinks that you want to get javascript back or doesn't
have anything else to return.

//jarkko

--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi
625e99cca23b3893a070c84dc3b0ac13?d=identicon&s=25 Justin Perkins (Guest)
on 2008-07-08 17:15
(Received via mailing list)
This list is being phased out, you should move your JS questions to
the new list here:
http://groups.google.com/group/prototype-scriptaculous

To your question, this isn't really a JavaScript related question as
it deals with the server responding to different content types. You
should look into RESTful style coding practices, wikipedia:
http://en.wikipedia.org/wiki/Representational_State_Transfer

But basically, in Rails, it is dealing with different content types
within a single action, such as:

def show
  respond_to do |wants|
    wants.html do
      # HTML response goes here
    end
    wants.js do
      render :update do |page|
        page.alert "hello from javascript"
      end
    end
end
82476266af9d460415d8f1fc16bb54ed?d=identicon&s=25 Jarkko Laine (jarkko)
on 2008-07-08 18:04
(Received via mailing list)
Attachment: smime.p7s (2 KB)
On 8.7.2008, at 18.14, Justin Perkins wrote:
> But basically, in Rails, it is dealing with different content types
> within a single action, such as:
>
> def show
>   ...
> end

Although, in Rails 2.1, the correct template type is rendered
automatically, so you don't necessary need to use respond_to anymore,
unless need some more complex logic in the controller action.

//jarkko

--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi
This topic is locked and can not be replied to.