Forum: Ruby on Rails AJAX redirect, with absolute URL, corrupts the URL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dc218395c242f9feb76c62aea1183874?d=identicon&s=25 helzer (Guest)
on 2007-07-07 02:57
(Received via mailing list)
I'm trying to redirect the browser to a URL outside of my domain on
some AJAX calls.
I do:

 page.redirect_to(some_url)

It works fine with internal URLs, when I supply the :action
and :controller, but absolute URLs fail. Rails insists on applying
HTML encoding to the URL, thus replacing the & signs between arguments
to &

* Same thing happens if I do the redirect from the .rjs template or
from the controller.

Do I need to do something else to get this working?

Thanks,
Amir
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-07-07 04:52
(Received via mailing list)
helzer wrote:

> page.redirect_to(some_url)
>
> It works fine with internal URLs, when I supply the :action
> and :controller, but absolute URLs fail. Rails insists on applying
> HTML encoding to the URL, thus replacing the & signs between arguments
> to &

That might be an insect. Try more raw JavaScript:

page << "window.location.href = '#{my_uri}';"

--
  Phlip
  http://www.oreilly.com/catalog/9780596510657/
  "Test Driven Ajax (on Rails)"
  assert_xpath, assert_javascript, & assert_ajax
Dc218395c242f9feb76c62aea1183874?d=identicon&s=25 helzer (Guest)
on 2007-07-07 13:45
(Received via mailing list)
Thanks Phlip,

That works great.

Amir
This topic is locked and can not be replied to.