I am implementing some AJAX features into a web forum, and one feature works fine in Firefox and in IE, but it is choking in Safari. Safari will send the request fine and the data will be stored in the DB, but it is not responding correctly to the RJS that is being sent back. Anybody notice issues with Safari parsing the javascript sent back to the browser? -- Timothy Johnson
Hi Timothy, I just dealt with this exact problem. The issue seems to be that rails wraps rjs responses in a javascript try/catch block in development mode. Like this... try { close_lightbox(); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''close_lightbox();''); throw e } Safari chokes on the try/catch and doesn''t run your code. For me the solution was to set the following in development.rb: config.action_view.debug_rjs = false which will simplify the rjs response to... close_lightbox(); Hope this helps! __ Simon Claret On 6/23/06, Timothy Johnson <found@foundinteractive.com> wrote:> I am implementing some AJAX features into a web forum, and one feature > works fine in Firefox and in IE, but it is choking in Safari. Safari > will send the request fine and the data will be stored in the DB, but > it is not responding correctly to the RJS that is being sent back. > > Anybody notice issues with Safari parsing the javascript sent back to > the browser? > > -- > Timothy Johnson > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060623/3676a679/attachment.html
On Jun 23, 2006, at 3:42 PM, simon claret wrote:> Hi Timothy, I just dealt with this exact problem. > > The issue seems to be that rails wraps rjs responses in a > javascript try/catch block in development mode. Like this... > > try { > close_lightbox(); > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert > (''close_lightbox();''); throw e } > > Safari chokes on the try/catch and doesn''t run your code. > > For me the solution was to set the following in development.rb: > > config.action_view.debug_rjs = false > > which will simplify the rjs response to... > > close_lightbox(); > > Hope this helps! > __ > > Simon Claret > > On 6/23/06, Timothy Johnson <found@foundinteractive.com> wrote: > > I am implementing some AJAX features into a web forum, and one > feature > > works fine in Firefox and in IE, but it is choking in Safari. Safari > > will send the request fine and the data will be stored in the DB, > but > > it is not responding correctly to the RJS that is being sent back. > > > > Anybody notice issues with Safari parsing the javascript sent > back to > > the browser? > >It''s possible this try/catch bug is fixed already in Webkit. If you feel like living on the edge, try downloading one of the nightly builds. See instructions here [1] on how to upgrade Safari to use it. cr [1] http://webkit.opendarwin.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060623/a39521e4/attachment-0001.html
Thanks Simon, That answered my question sufficiently. Stinks, but at least when I throw it into production the issues are gone. -- Timothy Johnson On Jun 23, 2006, at 4:42 PM, simon claret wrote:> Hi Timothy, I just dealt with this exact problem. > > The issue seems to be that rails wraps rjs responses in a javascript > try/catch block in development mode. Like this... > > try { > close_lightbox(); > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); > alert(''close_lightbox();''); throw e } > > Safari chokes on the try/catch and doesn''t run your code. > > For me the solution was to set the following in development.rb: > > config.action_view.debug_rjs = false > > which will simplify the rjs response to... > > close_lightbox(); > > Hope this helps! > __ > > Simon Claret > > On 6/23/06, Timothy Johnson <found@foundinteractive.com> wrote: >> I am implementing some AJAX features into a web forum, and one feature >> works fine in Firefox and in IE, but it is choking in Safari. Safari >> will send the request fine and the data will be stored in the DB, but >> it is not responding correctly to the RJS that is being sent back. >> >> Anybody notice issues with Safari parsing the javascript sent back to >> the browser? >> >> -- >> Timothy Johnson >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails