3
按照Michael Hartl的教程。在Ubuntu下使用Rails 3.0.9。以下頭文件位於application.html.erb中:Rails 3確認刪除 - 在IE8中,按取消仍然刪除
<head>
<title><%= title %></title>
<%= csrf_meta_tag %>
<%= render 'layouts/stylesheets' %>
<%= javascript_include_tag :defaults %>
</head>
沒有jQuery。教程Listing 10.38指定的刪除操作被如下叫:
<%= link_to "delete", user, :method => :delete, :confirm => "You sure?",
:title => "Delete #{user.name}" %>
這裏是生成的HTML的例子:
<a href="https://stackoverflow.com/users/13" data-confirm="You sure?" data-method="delete"
rel="nofollow" title="Delete Mylene Gaylord">delete</a>
我已經在三個瀏覽器測試的確認:
- Firefox 3下的Ubuntu:「確定」刪除用戶,「取消」不(好)
- Win7下的Firefox 5:「確定」刪除用戶,「Canc EL」不(好)的Win7下
- IE8:既‘確定’和‘取消’刪除用戶
當使用IE8,爲什麼取消調用刪除代碼,我該怎麼辦(糟糕!)修理它?有沒有一種方法可以測試Cancel,事實上,取消操作,無論使用什麼瀏覽器?
2011年9月29日更新:升級到Rails 3.1並將Prototype轉換爲jQuery(教程部分13.1.4)後,IE8的行爲正常:按下Cancel將中止刪除操作。然而,這並沒有回答爲什麼IE8不能從原型中取消Rails 3.0.9的原始問題。
似乎有關於http://stackoverflow.com/questions/3772450/rails-3-method-delete-doesnt-work-in-internet同一主題類似的問題-explorer – AndreDurao
謝謝@AndreDurao。我看到了,但我認爲這是不同的。我沒有使用jQuery,我使用了Rails的更高版本,並且我得到了彈出窗口;只是在IE8中,取消按鈕不會取消操作。 –