browser-history

Updating an iframe, history and URL. Then making it work with back button

荒凉一梦 提交于 2019-12-02 00:32:47
问题 I'm having problems getting URL to update when hitting the back button on the browser (I'm on testing on Firefox). After updating the "src" property of the iframe I use replaceState to update the history. If I hit the back button after this the iframe will go back to the previous page but the URL does not update to reflect this. function updateURLBar(urlInfo) { var stateObj = { foo: "bar" }; document.getElementById("iframeContent").src = urlInfo[1]; window.history.replaceState(stateObj, "page

Move backward through history skipping the same page with different query string

空扰寡人 提交于 2019-12-01 20:51:28
When I refresh a page or redirect to the same one using the same url, I can click in a button with "window.history.back();" code and go back to the previous page. However, If the query string was changed, I just back to the same page when I try to move back. Example 1: page1.html -> page2.html -> page2.html -> [click back button] -> page1.html Example 2: page1.html -> page2.html -> page2.html?x=123 -> [click back button] -> page2.html What I want: page1.html -> page2.html -> page2.html?x=123 -> [click back button] -> page1.html So, the question is, Can I check if the page is the same using

change URL link with javascript without refresh

这一生的挚爱 提交于 2019-12-01 18:37:18
问题 Is it possible to automatically change the url example.com/4000/title-2/#!4000 to example.com/4000/title-2 without to refresh the page ? Basically to remove "/#!4000" from the URL. Note that is important to remove the "/" before the hashbang not just the hashbang . 回答1: dont know if it is enough for you and whether it works completely cross-browser... chrome accepts: location.hash = ""; but this keeps the "#" in the address bar in modern browsers that completely support the html5 history api

GWT back button browser

被刻印的时光 ゝ 提交于 2019-12-01 18:33:16
For example current page is www.google.com. But I typed a different website address in address bar and clicked. This site has fully GWT code. But I like to back to the previous page of www.google.com. So I clicked back button of browser.but how can I get event of back button from current GWT code. Can I set any backbutton event handler in GWT of current page? One which notifies an alert to me that back button was pressed. Is there any solution from GWT? +1 to Igor and Alex. Here's some code you can use, if you want to use the ClosingHandler: Window.addWindowClosingHandler(new Window

change URL link with javascript without refresh

蹲街弑〆低调 提交于 2019-12-01 18:28:55
Is it possible to automatically change the url example.com/4000/title-2/#!4000 to example.com/4000/title-2 without to refresh the page ? Basically to remove "/#!4000" from the URL. Note that is important to remove the "/" before the hashbang not just the hashbang . Tobias Krogh dont know if it is enough for you and whether it works completely cross-browser... chrome accepts: location.hash = ""; but this keeps the "#" in the address bar in modern browsers that completely support the html5 history api you do: window.history.replaceState('Object', 'Title', '/4000/title-2'); EDIT: this dies not

javascript browser history listing

浪尽此生 提交于 2019-12-01 18:20:48
I am familiar with the window.history.back() and the window.history.forward() javascript objects. But is there a method of creating an array with the last "X" number pages viewed. No, this would be a huge security problem. You can get history.length to count them if you wish. J Max Check out: How do you get the previous url in Javascript? In short you can get the number of previous sites visited ( history.length ) but not the url's. 来源: https://stackoverflow.com/questions/17032415/javascript-browser-history-listing

GWT back button browser

你。 提交于 2019-12-01 17:21:19
问题 For example current page is www.google.com. But I typed a different website address in address bar and clicked. This site has fully GWT code. But I like to back to the previous page of www.google.com. So I clicked back button of browser.but how can I get event of back button from current GWT code. Can I set any backbutton event handler in GWT of current page? One which notifies an alert to me that back button was pressed. Is there any solution from GWT? 回答1: +1 to Igor and Alex. Here's some

javascript browser history listing

你。 提交于 2019-12-01 17:14:42
问题 I am familiar with the window.history.back() and the window.history.forward() javascript objects. But is there a method of creating an array with the last "X" number pages viewed. 回答1: No, this would be a huge security problem. You can get history.length to count them if you wish. 回答2: Check out: How do you get the previous url in Javascript? In short you can get the number of previous sites visited ( history.length ) but not the url's. 来源: https://stackoverflow.com/questions/17032415

Is there a way to tell what direction the state is going with history.js?

允我心安 提交于 2019-12-01 01:08:18
问题 Like the title says, I'd like to be able to perform a different onstatechange event if the pushState function is called, instead of the back function. Or, if the go function is negative or positive. Example: if History.pushState() or History.go(1) are called, i want the statechange event's callback to be forwardPushState if History.back() or History.go(-1) are called, i want the statechange event's callback to be backwardsPushState 回答1: A state is some data related to a page (as the user see

Add to browser history without page reload

僤鯓⒐⒋嵵緔 提交于 2019-11-30 17:17:37
Basically, I have a page that contains a form. When a user submits that form, a Javscript function is called and the user is dynamically presented with a new form. At this point, what I would like is for the user to be able to click the browser's back button and be taken back to the first form. Is this possible? Thanks for the quick responses, but I am having trouble getting pushState to work. The HTML still displays "second form" after I click the back button. Here is the code I used to test it: <script> function newPage(){ history.pushState({state:1}, "State 1", "?state=1"); document