Ruby on rails 3 如何更改地址栏中的url?

Ruby on rails 3 如何更改地址栏中的url?,ruby-on-rails-3,browser-history,Ruby On Rails 3,Browser History,我有一个带有两个选项卡的登录页,当我点击选项卡B时,我使用js和update div $.get("/users", function(data) {}); $('.userTable').html("<%= escape_javascript render(:file => 'users/index.html.erb') %> "); $.get(“/users”,函数(数据){}); $('.userTable').html(“'users/index.html.er

我有一个带有两个选项卡的登录页,当我点击选项卡B时,我使用js和update div

$.get("/users", function(data) {}); 

$('.userTable').html("<%= escape_javascript render(:file => 'users/index.html.erb') %> ");
$.get(“/users”,函数(数据){});
$('.userTable').html(“'users/index.html.erb')%>”;

如何在地址栏中更改url??每个选项卡都有创建、编辑等功能,这也是我使用ajax所做的。如何更改地址栏中的url以创建和更新??我查了一些铁路公司,但他们都没提到积垢。非常感谢您的帮助。

您可以使用历史操作api:

//Change address to http://www.test.com/page.php:
history.pushState('', '', 'http://www.test.com/page.php');
看 或

是所有浏览器版本都支持pushState()方法,还是只支持每个浏览器的lasst版本?这将如何工作?我将从这里获得要传递到这里的url
history.pushState(“,”从哪里??)不是“从何处”而是到何处。只需将上面的代码输入到javascript代码中,您就会看到地址栏中的url发生更改。