针对使用JavaScript更改重新加载时当前页面的URL和js实现页面重新加载这两个问题,本篇文章进行了详细的解答,同时本文还将给你拓展535种使用JavaScript重新加载页面的方法、javas
针对使用JavaScript更改重新加载时当前页面的URL和js实现页面重新加载这两个问题,本篇文章进行了详细的解答,同时本文还将给你拓展535种使用JavaScript重新加载页面的方法、javascript - 第二次ajax提取页面的时候,main.js没有重新加载,或者说,所有的js都没有重新加载的问题、javascript – 使用jQuery在页面加载时将字符串添加到url?、javascript – 使用jQuery重新加载特定元素等相关知识,希望可以帮助到你。
本文目录一览:- 使用JavaScript更改重新加载时当前页面的URL(js实现页面重新加载)
- 535种使用JavaScript重新加载页面的方法
- javascript - 第二次ajax提取页面的时候,main.js没有重新加载,或者说,所有的js都没有重新加载的问题
- javascript – 使用jQuery在页面加载时将字符串添加到url?
- javascript – 使用jQuery重新加载特定元素
使用JavaScript更改重新加载时当前页面的URL(js实现页面重新加载)
我的要求是在单击刷新图标或Ctrl R时更改当前页面的URL.即在刷新时,重新加载另一个页面(不同的URL).并且它应该支持所有浏览器.我已经尝试了以下代码段.但是它不起作用.
window.onbeforeunload = function(e) {
window.location.href = 'www.google.com';
};
“ google.com”应为刷新当前页面时我页面的URL.但这与window.onbeforeunload()无关.
解决方法:
OnBeforeUnload需要一个返回值才能工作,但实际上,它只会显示一条消息,询问用户是否确定要离开该页面(就像Facebook在您尝试保留一些待处理的更改而离开页面时一样).
据我所知,Web浏览器不想让您对此进行控制,这主要是由于网站在用户尝试离开时会重定向用户并进行此类操作,因此,没有什么比“标准方法”更重要的了,即使您找到了解决方法,我很确定它不会在所有浏览器上都起作用.
但是,为什么客户希望他的网站上有这种行为?至少在我看来,他将获得的唯一一件事是给最终用户带来可怕的用户体验.
535种使用JavaScript重新加载页面的方法
除了location = location
之外还有534中方法重新加载页面
location = location
location = location.href
location = window.location
location = self.location
location = window.location.href
location = self.location.href
location = location[''href'']
location = window[''location'']
location = window[''location''].href
location = window[''location''][''href'']
location = window.location[''href'']
location = self[''location'']
location = self[''location''].href
location = self[''location''][''href'']
location = self.location[''href'']
location.assign(location)
location.replace(location)
window.location.assign(location)
window.location.replace(location)
self.location.assign(location)
self.location.replace(location)
location[''assign''](location)
location[''replace''](location)
window.location[''assign''](location)
window.location[''replace''](location)
window[''location''].assign(location)
window[''location''].replace(location)
window[''location''][''assign''](location)
window[''location''][''replace''](location)
self.location[''assign''](location)
self.location[''replace''](location)
self[''location''].assign(location)
self[''location''].replace(location)
self[''location''][''assign''](location)
self[''location''][''replace''](location)
location.href = location
location.href = location.href
location.href = window.location
location.href = self.location
location.href = window.location.href
location.href = self.location.href
location.href = location[''href'']
location.href = window[''location'']
location.href = window[''location''].href
location.href = window[''location''][''href'']
location.href = window.location[''href'']
location.href = self[''location'']
location.href = self[''location''].href
location.href = self[''location''][''href'']
location.href = self.location[''href'']
location.assign(location.href)
location.replace(location.href)
window.location.assign(location.href)
window.location.replace(location.href)
self.location.assign(location.href)
self.location.replace(location.href)
location[''assign''](location.href)
location[''replace''](location.href)
window.location[''assign''](location.href)
window.location[''replace''](location.href)
window[''location''].assign(location.href)
window[''location''].replace(location.href)
window[''location''][''assign''](location.href)
window[''location''][''replace''](location.href)
self.location[''assign''](location.href)
self.location[''replace''](location.href)
self[''location''].assign(location.href)
self[''location''].replace(location.href)
self[''location''][''assign''](location.href)
self[''location''][''replace''](location.href)
window.location = location
window.location = location.href
window.location = window.location
window.location = self.location
window.location = window.location.href
window.location = self.location.href
window.location = location[''href'']
window.location = window[''location'']
window.location = window[''location''].href
window.location = window[''location''][''href'']
window.location = window.location[''href'']
window.location = self[''location'']
window.location = self[''location''].href
window.location = self[''location''][''href'']
window.location = self.location[''href'']
location.assign(window.location)
location.replace(window.location)
window.location.assign(window.location)
window.location.replace(window.location)
self.location.assign(window.location)
self.location.replace(window.location)
location[''assign''](window.location)
location[''replace''](window.location)
window.location[''assign''](window.location)
window.location[''replace''](window.location)
window[''location''].assign(window.location)
window[''location''].replace(window.location)
window[''location''][''assign''](window.location)
window[''location''][''replace''](window.location)
self.location[''assign''](window.location)
self.location[''replace''](window.location)
self[''location''].assign(window.location)
self[''location''].replace(window.location)
self[''location''][''assign''](window.location)
self[''location''][''replace''](window.location)
self.location = location
self.location = location.href
self.location = window.location
self.location = self.location
self.location = window.location.href
self.location = self.location.href
self.location = location[''href'']
self.location = window[''location'']
self.location = window[''location''].href
self.location = window[''location''][''href'']
self.location = window.location[''href'']
self.location = self[''location'']
self.location = self[''location''].href
self.location = self[''location''][''href'']
self.location = self.location[''href'']
location.assign(self.location)
location.replace(self.location)
window.location.assign(self.location)
window.location.replace(self.location)
self.location.assign(self.location)
self.location.replace(self.location)
location[''assign''](self.location)
location[''replace''](self.location)
window.location[''assign''](self.location)
window.location[''replace''](self.location)
window[''location''].assign(self.location)
window[''location''].replace(self.location)
window[''location''][''assign''](self.location)
window[''location''][''replace''](self.location)
self.location[''assign''](self.location)
self.location[''replace''](self.location)
self[''location''].assign(self.location)
self[''location''].replace(self.location)
self[''location''][''assign''](self.location)
self[''location''][''replace''](self.location)
window.location.href = location
window.location.href = location.href
window.location.href = window.location
window.location.href = self.location
window.location.href = window.location.href
window.location.href = self.location.href
window.location.href = location[''href'']
window.location.href = window[''location'']
window.location.href = window[''location''].href
window.location.href = window[''location''][''href'']
window.location.href = window.location[''href'']
window.location.href = self[''location'']
window.location.href = self[''location''].href
window.location.href = self[''location''][''href'']
window.location.href = self.location[''href'']
location.assign(window.location.href)
location.replace(window.location.href)
window.location.assign(window.location.href)
window.location.replace(window.location.href)
self.location.assign(window.location.href)
self.location.replace(window.location.href)
location[''assign''](window.location.href)
location[''replace''](window.location.href)
window.location[''assign''](window.location.href)
window.location[''replace''](window.location.href)
window[''location''].assign(window.location.href)
window[''location''].replace(window.location.href)
window[''location''][''assign''](window.location.href)
window[''location''][''replace''](window.location.href)
self.location[''assign''](window.location.href)
self.location[''replace''](window.location.href)
self[''location''].assign(window.location.href)
self[''location''].replace(window.location.href)
self[''location''][''assign''](window.location.href)
self[''location''][''replace''](window.location.href)
self.location.href = location
self.location.href = location.href
self.location.href = window.location
self.location.href = self.location
self.location.href = window.location.href
self.location.href = self.location.href
self.location.href = location[''href'']
self.location.href = window[''location'']
self.location.href = window[''location''].href
self.location.href = window[''location''][''href'']
self.location.href = window.location[''href'']
self.location.href = self[''location'']
self.location.href = self[''location''].href
self.location.href = self[''location''][''href'']
self.location.href = self.location[''href'']
location.assign(self.location.href)
location.replace(self.location.href)
window.location.assign(self.location.href)
window.location.replace(self.location.href)
self.location.assign(self.location.href)
self.location.replace(self.location.href)
location[''assign''](self.location.href)
location[''replace''](self.location.href)
window.location[''assign''](self.location.href)
window.location[''replace''](self.location.href)
window[''location''].assign(self.location.href)
window[''location''].replace(self.location.href)
window[''location''][''assign''](self.location.href)
window[''location''][''replace''](self.location.href)
self.location[''assign''](self.location.href)
self.location[''replace''](self.location.href)
self[''location''].assign(self.location.href)
self[''location''].replace(self.location.href)
self[''location''][''assign''](self.location.href)
self[''location''][''replace''](self.location.href)
location[''href''] = location
location[''href''] = location.href
location[''href''] = window.location
location[''href''] = self.location
location[''href''] = window.location.href
location[''href''] = self.location.href
location[''href''] = location[''href'']
location[''href''] = window[''location'']
location[''href''] = window[''location''].href
location[''href''] = window[''location''][''href'']
location[''href''] = window.location[''href'']
location[''href''] = self[''location'']
location[''href''] = self[''location''].href
location[''href''] = self[''location''][''href'']
location[''href''] = self.location[''href'']
location.assign(location[''href''])
location.replace(location[''href''])
window.location.assign(location[''href''])
window.location.replace(location[''href''])
self.location.assign(location[''href''])
self.location.replace(location[''href''])
location[''assign''](location[''href''])
location[''replace''](location[''href''])
window.location[''assign''](location[''href''])
window.location[''replace''](location[''href''])
window[''location''].assign(location[''href''])
window[''location''].replace(location[''href''])
window[''location''][''assign''](location[''href''])
window[''location''][''replace''](location[''href''])
self.location[''assign''](location[''href''])
self.location[''replace''](location[''href''])
self[''location''].assign(location[''href''])
self[''location''].replace(location[''href''])
self[''location''][''assign''](location[''href''])
self[''location''][''replace''](location[''href''])
window[''location''] = location
window[''location''] = location.href
window[''location''] = window.location
window[''location''] = self.location
window[''location''] = window.location.href
window[''location''] = self.location.href
window[''location''] = location[''href'']
window[''location''] = window[''location'']
window[''location''] = window[''location''].href
window[''location''] = window[''location''][''href'']
window[''location''] = window.location[''href'']
window[''location''] = self[''location'']
window[''location''] = self[''location''].href
window[''location''] = self[''location''][''href'']
window[''location''] = self.location[''href'']
location.assign(window[''location''])
location.replace(window[''location''])
window.location.assign(window[''location''])
window.location.replace(window[''location''])
self.location.assign(window[''location''])
self.location.replace(window[''location''])
location[''assign''](window[''location''])
location[''replace''](window[''location''])
window.location[''assign''](window[''location''])
window.location[''replace''](window[''location''])
window[''location''].assign(window[''location''])
window[''location''].replace(window[''location''])
window[''location''][''assign''](window[''location''])
window[''location''][''replace''](window[''location''])
self.location[''assign''](window[''location''])
self.location[''replace''](window[''location''])
self[''location''].assign(window[''location''])
self[''location''].replace(window[''location''])
self[''location''][''assign''](window[''location''])
self[''location''][''replace''](window[''location''])
window[''location''].href = location
window[''location''].href = location.href
window[''location''].href = window.location
window[''location''].href = self.location
window[''location''].href = window.location.href
window[''location''].href = self.location.href
window[''location''].href = location[''href'']
window[''location''].href = window[''location'']
window[''location''].href = window[''location''].href
window[''location''].href = window[''location''][''href'']
window[''location''].href = window.location[''href'']
window[''location''].href = self[''location'']
window[''location''].href = self[''location''].href
window[''location''].href = self[''location''][''href'']
window[''location''].href = self.location[''href'']
location.assign(window[''location''].href)
location.replace(window[''location''].href)
window.location.assign(window[''location''].href)
window.location.replace(window[''location''].href)
self.location.assign(window[''location''].href)
self.location.replace(window[''location''].href)
location[''assign''](window[''location''].href)
location[''replace''](window[''location''].href)
window.location[''assign''](window[''location''].href)
window.location[''replace''](window[''location''].href)
window[''location''].assign(window[''location''].href)
window[''location''].replace(window[''location''].href)
window[''location''][''assign''](window[''location''].href)
window[''location''][''replace''](window[''location''].href)
self.location[''assign''](window[''location''].href)
self.location[''replace''](window[''location''].href)
self[''location''].assign(window[''location''].href)
self[''location''].replace(window[''location''].href)
self[''location''][''assign''](window[''location''].href)
self[''location''][''replace''](window[''location''].href)
window[''location''][''href''] = location
window[''location''][''href''] = location.href
window[''location''][''href''] = window.location
window[''location''][''href''] = self.location
window[''location''][''href''] = window.location.href
window[''location''][''href''] = self.location.href
window[''location''][''href''] = location[''href'']
window[''location''][''href''] = window[''location'']
window[''location''][''href''] = window[''location''].href
window[''location''][''href''] = window[''location''][''href'']
window[''location''][''href''] = window.location[''href'']
window[''location''][''href''] = self[''location'']
window[''location''][''href''] = self[''location''].href
window[''location''][''href''] = self[''location''][''href'']
window[''location''][''href''] = self.location[''href'']
location.assign(window[''location''][''href''])
location.replace(window[''location''][''href''])
window.location.assign(window[''location''][''href''])
window.location.replace(window[''location''][''href''])
self.location.assign(window[''location''][''href''])
self.location.replace(window[''location''][''href''])
location[''assign''](window[''location''][''href''])
location[''replace''](window[''location''][''href''])
window.location[''assign''](window[''location''][''href''])
window.location[''replace''](window[''location''][''href''])
window[''location''].assign(window[''location''][''href''])
window[''location''].replace(window[''location''][''href''])
window[''location''][''assign''](window[''location''][''href''])
window[''location''][''replace''](window[''location''][''href''])
self.location[''assign''](window[''location''][''href''])
self.location[''replace''](window[''location''][''href''])
self[''location''].assign(window[''location''][''href''])
self[''location''].replace(window[''location''][''href''])
self[''location''][''assign''](window[''location''][''href''])
self[''location''][''replace''](window[''location''][''href''])
window.location[''href''] = location
window.location[''href''] = location.href
window.location[''href''] = window.location
window.location[''href''] = self.location
window.location[''href''] = window.location.href
window.location[''href''] = self.location.href
window.location[''href''] = location[''href'']
window.location[''href''] = window[''location'']
window.location[''href''] = window[''location''].href
window.location[''href''] = window[''location''][''href'']
window.location[''href''] = window.location[''href'']
window.location[''href''] = self[''location'']
window.location[''href''] = self[''location''].href
window.location[''href''] = self[''location''][''href'']
window.location[''href''] = self.location[''href'']
location.assign(window.location[''href''])
location.replace(window.location[''href''])
window.location.assign(window.location[''href''])
window.location.replace(window.location[''href''])
self.location.assign(window.location[''href''])
self.location.replace(window.location[''href''])
location[''assign''](window.location[''href''])
location[''replace''](window.location[''href''])
window.location[''assign''](window.location[''href''])
window.location[''replace''](window.location[''href''])
window[''location''].assign(window.location[''href''])
window[''location''].replace(window.location[''href''])
window[''location''][''assign''](window.location[''href''])
window[''location''][''replace''](window.location[''href''])
self.location[''assign''](window.location[''href''])
self.location[''replace''](window.location[''href''])
self[''location''].assign(window.location[''href''])
self[''location''].replace(window.location[''href''])
self[''location''][''assign''](window.location[''href''])
self[''location''][''replace''](window.location[''href''])
self[''location''] = location
self[''location''] = location.href
self[''location''] = window.location
self[''location''] = self.location
self[''location''] = window.location.href
self[''location''] = self.location.href
self[''location''] = location[''href'']
self[''location''] = window[''location'']
self[''location''] = window[''location''].href
self[''location''] = window[''location''][''href'']
self[''location''] = window.location[''href'']
self[''location''] = self[''location'']
self[''location''] = self[''location''].href
self[''location''] = self[''location''][''href'']
self[''location''] = self.location[''href'']
location.assign(self[''location''])
location.replace(self[''location''])
window.location.assign(self[''location''])
window.location.replace(self[''location''])
self.location.assign(self[''location''])
self.location.replace(self[''location''])
location[''assign''](self[''location''])
location[''replace''](self[''location''])
window.location[''assign''](self[''location''])
window.location[''replace''](self[''location''])
window[''location''].assign(self[''location''])
window[''location''].replace(self[''location''])
window[''location''][''assign''](self[''location''])
window[''location''][''replace''](self[''location''])
self.location[''assign''](self[''location''])
self.location[''replace''](self[''location''])
self[''location''].assign(self[''location''])
self[''location''].replace(self[''location''])
self[''location''][''assign''](self[''location''])
self[''location''][''replace''](self[''location''])
self[''location''].href = location
self[''location''].href = location.href
self[''location''].href = window.location
self[''location''].href = self.location
self[''location''].href = window.location.href
self[''location''].href = self.location.href
self[''location''].href = location[''href'']
self[''location''].href = window[''location'']
self[''location''].href = window[''location''].href
self[''location''].href = window[''location''][''href'']
self[''location''].href = window.location[''href'']
self[''location''].href = self[''location'']
self[''location''].href = self[''location''].href
self[''location''].href = self[''location''][''href'']
self[''location''].href = self.location[''href'']
location.assign(self[''location''].href)
location.replace(self[''location''].href)
window.location.assign(self[''location''].href)
window.location.replace(self[''location''].href)
self.location.assign(self[''location''].href)
self.location.replace(self[''location''].href)
location[''assign''](self[''location''].href)
location[''replace''](self[''location''].href)
window.location[''assign''](self[''location''].href)
window.location[''replace''](self[''location''].href)
window[''location''].assign(self[''location''].href)
window[''location''].replace(self[''location''].href)
window[''location''][''assign''](self[''location''].href)
window[''location''][''replace''](self[''location''].href)
self.location[''assign''](self[''location''].href)
self.location[''replace''](self[''location''].href)
self[''location''].assign(self[''location''].href)
self[''location''].replace(self[''location''].href)
self[''location''][''assign''](self[''location''].href)
self[''location''][''replace''](self[''location''].href)
self[''location''][''href''] = location
self[''location''][''href''] = location.href
self[''location''][''href''] = window.location
self[''location''][''href''] = self.location
self[''location''][''href''] = window.location.href
self[''location''][''href''] = self.location.href
self[''location''][''href''] = location[''href'']
self[''location''][''href''] = window[''location'']
self[''location''][''href''] = window[''location''].href
self[''location''][''href''] = window[''location''][''href'']
self[''location''][''href''] = window.location[''href'']
self[''location''][''href''] = self[''location'']
self[''location''][''href''] = self[''location''].href
self[''location''][''href''] = self[''location''][''href'']
self[''location''][''href''] = self.location[''href'']
location.assign(self[''location''][''href''])
location.replace(self[''location''][''href''])
window.location.assign(self[''location''][''href''])
window.location.replace(self[''location''][''href''])
self.location.assign(self[''location''][''href''])
self.location.replace(self[''location''][''href''])
location[''assign''](self[''location''][''href''])
location[''replace''](self[''location''][''href''])
window.location[''assign''](self[''location''][''href''])
window.location[''replace''](self[''location''][''href''])
window[''location''].assign(self[''location''][''href''])
window[''location''].replace(self[''location''][''href''])
window[''location''][''assign''](self[''location''][''href''])
window[''location''][''replace''](self[''location''][''href''])
self.location[''assign''](self[''location''][''href''])
self.location[''replace''](self[''location''][''href''])
self[''location''].assign(self[''location''][''href''])
self[''location''].replace(self[''location''][''href''])
self[''location''][''assign''](self[''location''][''href''])
self[''location''][''replace''](self[''location''][''href''])
self.location[''href''] = location
self.location[''href''] = location.href
self.location[''href''] = window.location
self.location[''href''] = self.location
self.location[''href''] = window.location.href
self.location[''href''] = self.location.href
self.location[''href''] = location[''href'']
self.location[''href''] = window[''location'']
self.location[''href''] = window[''location''].href
self.location[''href''] = window[''location''][''href'']
self.location[''href''] = window.location[''href'']
self.location[''href''] = self[''location'']
self.location[''href''] = self[''location''].href
self.location[''href''] = self[''location''][''href'']
self.location[''href''] = self.location[''href'']
location.assign(self.location[''href''])
location.replace(self.location[''href''])
window.location.assign(self.location[''href''])
window.location.replace(self.location[''href''])
self.location.assign(self.location[''href''])
self.location.replace(self.location[''href''])
location[''assign''](self.location[''href''])
location[''replace''](self.location[''href''])
window.location[''assign''](self.location[''href''])
window.location[''replace''](self.location[''href''])
window[''location''].assign(self.location[''href''])
window[''location''].replace(self.location[''href''])
window[''location''][''assign''](self.location[''href''])
window[''location''][''replace''](self.location[''href''])
self.location[''assign''](self.location[''href''])
self.location[''replace''](self.location[''href''])
self[''location''].assign(self.location[''href''])
self[''location''].replace(self.location[''href''])
self[''location''][''assign''](self.location[''href''])
self[''location''][''replace''](self.location[''href''])
location.reload()
location[''reload'']()
window.location.reload()
window[''location''].reload()
window.location[''reload'']()
window[''location''][''reload'']()
self.location.reload()
self[''location''].reload()
self.location[''reload'']()
self[''location''][''reload'']()
更多关于JavaScript的文章推荐
- 如何使用异或(XOR)运算找到数组中缺失的数?
- 如何使用Three.js制作全息交互效果
- JavaScript闭包是如何工作的?
- 如何使用JavaScript重定向到其他网页?
- 如何实现链接悬停显示图像效果?
参考
- location = location
javascript - 第二次ajax提取页面的时候,main.js没有重新加载,或者说,所有的js都没有重新加载的问题
效果图:
在使用ajax做抽屉的效果时,第二次ajax提取页面的时候,js没有重新加载,怎么解决这个问题?
回复内容:
效果图:
在使用ajax做抽屉的效果时,第二次ajax提取页面的时候,js没有重新加载,怎么解决这个问题?
我的博客使用了类似的pjax技术,当初设计也遇到了类似的问题。
其实根本原因不在于js没有重新加载,其实他根本不需要重新加载,因为已经被加载过了。
根本原因在于其不会被重新执行。
你可以定义个文件叫bootstrap.js。
然后在里面逐个重新执行一遍需要重新加载的js即可。
ps 如果以前有写在公共区域的代码,即不属于任何函数的,需要你自行封装到一个函数里面,然后在这里执行。
比如:
a.js
立即学习“Java免费学习笔记(深入)”;
console.log(''test'');
这个js其实被加载过了,也执行过了,正常情况下是不会再执行了。
那么你就需要修改它为
a.js
var initAJs=function(){ console.log(''test''); }
然后在pjax成功返回的时候执行
initAjs即可。
javascript – 使用jQuery在页面加载时将字符串添加到url?
?aa_campaign = f45632
(http://examplesite.com/test.html)
它用于营销和跟踪.
我试过这个:
if window.location.href.indexOf("http://examplesite.com/test.html") { window.location = "http://examplesite.com/test.html?aa_campaign=f45632"; }
直接上升不起作用,但这个想法是我正在寻找的.有什么想法吗?
解决方法
if (window.location.href === "http://examplesite.com/test.html") { window.history.pushState("object or string","Title","http://examplesite.com/test.html?aa_campaign=f45632"); }
pushState()方法
pushState() takes three parameters: a state object,a title (which is
currently ignored),and (optionally) a URL. Let’s examine each of
these three parameters in more detail:06001
the user navigates to the new state,a popstate event is fired,and
the state property of the event contains a copy of the history entry’s
state object.06002
after the user restarts the browser,we impose a size limit of 640k
characters on the serialized representation of a state object. If you
pass a state object whose serialized representation is larger than
this to pushState(),the method will throw an exception. If you need
more space than this,you’re encouraged to use sessionStorage and/or
localStorage.06003
against future changes to the method. Alternatively,you Could pass a
short title for the state to which you’re moving.06004
pushState(),but it might attempt to load the URL later,for instance
after the user restarts the browser. The new URL does not need to be
absolute; if it’s relative,it’s resolved relative to the current URL.
The new URL must be of the same origin as the current URL; otherwise,
pushState() will throw an exception. This parameter is optional; if it
isn’t specified,it’s set to the document’s current URL.
SRC:https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history
javascript – 使用jQuery重新加载特定元素
<script> $(document).ready(function() { $("#button").click(function() { $("#demo").load(location.href + "#demo"); }); }); </script> </head> <body> <div id="example"> <p id="demo">hi</p> <button id="button" type="button">press</button> </div>
解决方法
load()
与选择器一起使用.
$("#demo").load(location.href + " #demo"); // Add space between URL and selector. ^
这将仅加载location.href URL中的#demo元素.
今天关于使用JavaScript更改重新加载时当前页面的URL和js实现页面重新加载的介绍到此结束,谢谢您的阅读,有关535种使用JavaScript重新加载页面的方法、javascript - 第二次ajax提取页面的时候,main.js没有重新加载,或者说,所有的js都没有重新加载的问题、javascript – 使用jQuery在页面加载时将字符串添加到url?、javascript – 使用jQuery重新加载特定元素等更多相关知识的信息可以在本站进行查询。
本文标签: