是否可以使 window.location.replace
或 window.location.href
像简单链接一样与 turbolinks 一起工作?
最佳答案
来自文档:https://github.com/rails/turbolinks#triggering-a-turbolinks-visit-manually
You can use
Turbolinks.visit(path)
to go to a URL through Turbolinks.You can also use
redirect_to path, turbolinks: true
(orturbolinks: :advance
) in Rails to perform a redirect via Turbolinks.
这应该有效:
Turbolinks.visit('http://google.com')
关于javascript - 使用来自 javascript 的 turbolinks 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25670343/