page-refresh

How to force reloading a page when using browser back button?

落爺英雄遲暮 提交于 2019-11-27 03:17:37
I need to somehow detect that the user has pressed a browsers back button and reload the page with refresh (reloading the content and CSS) using jquery. How to detect such action via jquery? Because right now some elements are not reloaded if I use the back button in a browser. But if I use links in the website everything is refreshed and showed correctly. IMPORTANT! Some people have probably misunderstood what I want. I don't want to refresh the current page. I want to refresh the page that is loaded after I press the back button. here is what I mean in a more detailed way: user is visiting

Execute function before refresh

一世执手 提交于 2019-11-26 17:32:59
问题 On my HTML page, when the user clicks / presses F5 button the page refreshes, but before it refreshes I want to execute a function or a simple alert. User can click on refresh button, press F5 or Ctrl + R . Using core JavaScript, jQuery or YUI. 回答1: window.onbeforeunload = function(event) { return confirm("Confirm refresh"); }; 回答2: $(window).bind('beforeunload', function(){ return '>>>>>Before You Go<<<<<<<< \n Your custom message go here'; }); Source: http://www.mkyong.com/jquery/how-to

How to force reloading a page when using browser back button?

旧城冷巷雨未停 提交于 2019-11-26 17:26:56
问题 I need to somehow detect that the user has pressed a browsers back button and reload the page with refresh (reloading the content and CSS) using jquery. How to detect such action via jquery? Because right now some elements are not reloaded if I use the back button in a browser. But if I use links in the website everything is refreshed and showed correctly. IMPORTANT! Some people have probably misunderstood what I want. I don't want to refresh the current page. I want to refresh the page that

retain angular variables after page refresh

余生长醉 提交于 2019-11-26 16:58:45
问题 I'm trying to figure out a way to keep my angular variables with page refresh / across controllers. My workflow is, user logs in via facebook and gets an access token users access token will be used with every request I tried two ways, 1 - Assigning the token to a rootScope Not working 2 - By using a factory #app.js 'use strict'; angular.module('recipeapp', []) .run(['$rootScope', '$injector', 'Authenticate', function($rootScope,$injector, Authenticate){ $injector.get("$http").defaults

Force page scroll position to top at page refresh in HTML

女生的网名这么多〃 提交于 2019-11-26 15:20:00
问题 I am building a website which I am publishing with div s. When I refresh the page after it was scrolled to position X, then the page is loaded with the scroll position as X. How can I force the page to be scrolled to the top on page refresh? What I can think of is of some JS or jQuery run as onLoad() function of the page to SET the pages scroll to top. But I don't know how I could do that. A better option would be if there is some property or something to have the page loaded with its scroll

JavaScript hard refresh of current page

橙三吉。 提交于 2019-11-26 15:07:39
How can I force the web browser to do a hard refresh of the page via JavaScript? Hard refresh means getting a fresh copy of the page AND refresh all the external resources (images, JavaScript, CSS, etc.). CMS Try to use: location.reload(true); When this method receives a true value as argument, it will cause the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache. More info: The location object window.location.href = window.location.href 来源: https://stackoverflow.com/questions/2099201/javascript-hard-refresh-of-current

JavaScript hard refresh of current page

跟風遠走 提交于 2019-11-26 04:10:56
问题 How can I force the web browser to do a hard refresh of the page via JavaScript? Hard refresh means getting a fresh copy of the page AND refresh all the external resources (images, JavaScript, CSS, etc.). 回答1: Try to use: location.reload(true); When this method receives a true value as argument, it will cause the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache. More info: The location object 回答2: window.location.href

Refresh a page using JavaScript or HTML [duplicate]

大城市里の小女人 提交于 2019-11-26 02:30:13
问题 This question already has answers here : How to reload a page using JavaScript (18 answers) Closed 3 years ago . How can I refresh a page using JavaScript or HTML? 回答1: window.location.reload(); in JavaScript <meta http-equiv="refresh" content="1"> in HTML (where 1 = 1 second). 回答2: Here are 535 ways to reload a page using javascript, very cool: Here are the first 20: location = location location = location.href location = window.location location = self.location location = window.location

Check if page gets reloaded or refreshed in JavaScript

守給你的承諾、 提交于 2019-11-25 21:58:47
问题 I want to check when someone tries to refresh a page. For example, when I open a page nothing happens but when I refresh the page it should display an alert. 回答1: A better way to know that the page is actually reloaded is to use the navigator object that is supported by most modern browsers. It uses the Navigation Timing API. //check for Navigation Timing API support if (window.performance) { console.info("window.performance works fine on this browser"); } if (performance.navigation.type == 1