browser-history

Does back/forward in the browser change javascript variables?

放肆的年华 提交于 2019-11-30 15:27:40
<script type="text/javascript> var x = 0; //this occurs in the beginning of the page. $("#button").onclick{ x = 1; } </script> Let's say the variable "x" changes to 1. Then the user clicks a link. When the user clicks "back", will x be 0 or 1? It will be 0 . The browser does not cache the state of Javascript variables between page loads. Update This is not the case in browsers such as Firefox. Please see Trey's answer. Trey Hunner As detailed in another question , the real answer to this question is it depends on the browser . In Firefox and Opera, the below page will preserve the state of 1

Get last page visited

混江龙づ霸主 提交于 2019-11-30 14:28:13
I need to know if a person that comes to my website went from an another specific website. Example: User A visits www.youtube.com/myvideo and clicks on a link to my website. User B visits google, search my website and click the link. Results Message on my page: User A: Welcome! You already know how it works, register now! User B: Welcome! Please watch our video first at www.youtube.com/myvideo My question is: Is it possible to know the last url the user visited before entering my page? I already tried $_SERVER['HTTP_REFERER'] with PHP, but it's not working correctly and I read that does not

HTML5 History API: JSON displayed when going “back” to another page, and then “forward” again

a 夏天 提交于 2019-11-30 14:00:07
问题 I have a page where there are several search / filter button which, when clicked, refresh the contents of a list below through AJAX. In the process, I'm modifying history (through pushstate) so that the new filtered page is bookmarkable, and so the back button works. I'm also listening for the popstate event, to react to Back. My code looks more or less like this: window.addEventListener("popstate", function(ev) { if (!window.history_ready) { return; } // Avoid the one time it runs on load

Popstate - passing popped state to event handler

亡梦爱人 提交于 2019-11-30 13:40:34
The following code should cause an alert of '1', but instead does nothing. window.onpopstate = function(event) { alert(event.state.a) } history.pushState({a: 1}) history.back() Fiddle: http://jsfiddle.net/WNurW/2/ Any ideas? Your code woudn't cause a popstate, as the pushstate command tells what page you are on NOW. window.onpopstate = function(event) { alert(event.state.a) } history.pushState({a: 1}); history.pushState({a: 2}); history.back() The above code will work. Heres the fiddle: http://jsfiddle.net/WNurW/8/ As you can see on the above picture: (1) Here you entered the page, or the

How to implement my own history stack in a single page mobile web application?

妖精的绣舞 提交于 2019-11-30 11:27:28
问题 I have a single-page mobile application developed with Backbone and Zepto. It works correctly with the back/forward buttons in the browser. When the user navigates to a page, the new content slides in from the right as the old contents slides away to the left (and out of the viewport). I want the same thing to happen if the user presses the "forward" browser button. This all works. I've got a class that I add to the body element navigate-back that will flip this behaviour, so when the user

Chrome doesn't cache hidden form field values for use in browser history

人盡茶涼 提交于 2019-11-30 11:25:45
I have a ASP.Net web form that contains both text box fields and hidden fields. The hidden field values are modified dynamically using client side JavaScript. Posting the form, inspecting the values and redirecting to another page is all working as expected. However, when I use the browser back button to display the previous page then I expect so see that ALL form fields are still populated with the values that were posted. In IE and Firefox this is the case for both text and hidden input fields. In Chrome this is ONLY the case for text fields. The value of hidden fields is lost. Is it true

How to clear browsing history using WebBrowser control in C#

99封情书 提交于 2019-11-30 10:11:19
问题 I want to clear the browsing history of a WebBrowser control in C# after the WebBrowser completes its browsing. This is my code: try { foreach (string sr in File.ReadAllLines("link.txt")) { webBrowser1.Navigate(sr); webBrowser1.ScriptErrorsSuppressed = true; } while (webBrowser1.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); } } catch(Exception) { MessageBox.Show("Internet Connection not found","Error",MessageBoxButtons.OK,MessageBoxIcon.Error); this.Close(); } 回答1:

Current state of Jquery history/back-button plugins?

拜拜、爱过 提交于 2019-11-30 07:44:20
I spent a long time looking into this about a year ago, I tried: Jquery BBQ plugin Jquery History plugin jquery .address plugin I found the jquery.address plugin to be the best, but these things change quickly. Has anyone thoroughly researched the options for this RECENTLY? Keen to hear some thoughts before I integrate jquery.address again (I didn't have any issues with it before) Hey Guys, I'm the author of History.js which as SnippetSpace has said in his answer works with the HTML5 History API with an optional hash-fallback for older browsers. The HTML5 History API allows you to modify the

Preserve page state for revisiting using browser back button

南楼画角 提交于 2019-11-30 07:08:24
问题 I have a page that dynamically loads content based on a user pushing a button: ${document).ready(function) { $("#myButton").click(function() { $("#dynamicDiv").load("www.example.com"); }); } The dynamic content works fine, I can fetch pages all day long. But after you follow a link to another page, then press the browser back button to come back to the page, the page is completely reset as though no dynamic content had ever been loaded. I swear I've seen different behavior before, but maybe I

What format is the Safari History.db history_visits.visit_time in?

六月ゝ 毕业季﹏ 提交于 2019-11-30 05:14:35
When looking at the History.db from Safari, there's a table named history_visits which has a column named visit_time , which is a REAL value. It has values such as 470799793.096987 . What format is that in? I'd like to see it in a format such as 12/08/2015 05:12:05. It's the number in seconds since 00:00:00 UTC on 1 January 2001. It must be coming from an NSDate . NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time zone. Date objects are immutable, representing an invariant time interval relative to an absolute reference date (00:00:00