javascript - 需要 window.location.href 行为解释
问题描述
我注意到,当您不将 window.location.href 绑定到某些事件浏览器时,我不会返回页面。请解释为什么会这样
let link = document.getElementById('link');
link.addEventListener('click',function(){
window.location.href = "v.html"
})
// the code above works just fine and i can go back in history afterwards
// I can't do the same with the code below
if(1){
window.location.href = "v.html"
}
解决方案
推荐阅读
- firebase - 与 .limitToLast 一起用于分页时,如何仅使用 .onSnapshot 从 firebase 获取新文档
- python-3.x - 将属性添加到junit xml pytest
- java - 如何将响应 REST 客户端请求接收到的 JSON 对象转换为 Java 中的 MT940 Swift 文本文件?
- angular - 创建包含ngrx strore的角度模块
- python - 如何在 Tensorflow 中打印迭代器
- arrays - Flutter 自定义类包含数组
- node.js - Node.js 中的自定义事件编程:I/O 绑定的面向事件的设计模式?
- javascript - 不能在另一个脚本中使用脚本中的类
- php - 带有多部分/表单数据的 Guzzle PSR7 请求
- python - Python相当于clojure减少