Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
windows.location(url)如果 url 的域是当前页面的域,cookie 在执行时是否保留?
windows.location(url)
真正迂腐的是,更改Javascriptwindow.location会导致浏览器转到另一个站点,其中包括发出 GET 请求。换句话说,GET 请求和 Javascriptwindow.location是两个完全不同的东西;一个是 HTTP 请求类型,另一个是 DOM 属性。
window.location
但是,就问题而言,它们可以被认为是等效的。Cookie 被保留。
</pedantry>:)
</pedantry>
是的。这是同一件事,它将保留所有cookie。