Pjax - PDF在Pjax-Container中打开作为垃圾

时间:2012-05-31 09:49:34

标签: ruby-on-rails ruby-on-rails-3 pjax

我有Pjax加载我的网站的内部内容,但对于PDF它失败了,似乎尝试读取容器内的内容,而不是强迫它尝试其默认行为。导致像这样的东西

  

%PDF-1.4% 740 obj<> endobj xref 74 ...

http://nti.mywellbeing.org/articles/prioritising-tools-and-techniques然后点击“查找更多”按钮... http://ogilvyeast.mywellbeing.org/ckeditor_assets/attachments/14/8C_johari_window.pdf

如何使pjax失败/默认为标准行为?

谢谢

1 个答案:

答案 0 :(得分:3)

据我所知,你可能正在使用pjax-rails gem。在这种情况下,只需在PDF链接上设置data-skip-pjax属性即可执行整页加载:

<a href="/ckeditor_assets/attachments/14/8C_johari_window.pdf" target="_blank" data-skip-pjax="true">Find out more...</a>

或使用link_to

link_to "Find out more...", whatever_path, :target => "_blank", :"data-skip-pjax" => true