browser-history

Stop page from appearing in browser history

流过昼夜 提交于 2019-12-09 20:09:23
问题 I have a simple flow: A.html -> B.html -> C.html Now, page B either 302's (temporarily redirects giving 302 redirect code) to page C , or it shows a progress bar; then, after an ajax call is done, it redirects to page C . When the user is on C , and they hit "Back" I want them to end up on A instead of B . If the page did the 302 redirect, then the back behavior is what I want. Otherwise they get that intermediary page. Is there any way to solve this easily? 回答1: Presumably when the Ajax is

Delete browser history using jQuery

笑着哭i 提交于 2019-12-09 13:11:24
问题 I have an ajax application that is based on jQuery. I enabled browser history using jQuery history plugin. But we find out that the application generated too much history. Especially, we provide an in-page "ajax-back" button that enable the page to return to previous ajax state. When the in-page "ajax-back" button was pressed, we want it to act like the broswer back button, by moving the current index of the history, or removing the latest history record, instand of inserting a new history

How to trigger browser's back event/function using JavaScript?

本秂侑毒 提交于 2019-12-09 07:43:09
问题 I want to trigger the browser's back functionality through a hyperlink in my page template, using JavaScript (or PHP if possible). Does anyone know how to implement this? EDIT Found the solution using JavaScript. Here is the link if anyone needs it. And here's the code: <a href="#" onclick="history.back();return false;">Go back</a> 回答1: history.back() should do the trick. window.history.back() documentation at MDN As an aside, it's bad user experience if you do this unexpectedly on the user.

Pinterest like ajax loading

浪尽此生 提交于 2019-12-08 07:21:29
问题 I am working on a website with Wordpress where posts are to be loaded with AJAX while changing the url to the actual permalink of the post. Like how pinterest works. The AJAX loaded content is displayed in a modal box. I use window.history.pushState(stateObj, title, url) to change the url of the browser to the post's permalink. Now my problem is: When the modal box closes, I want to go to the previous url without reloading the page. e.g. I am on the homepage (http://example.com), then i click

AJAX Links Not Detected By A:Visited

╄→尐↘猪︶ㄣ 提交于 2019-12-07 09:30:01
问题 I'm noticing that a:visited styles don't work on links that are requested via JavaScript. On a standard user click though, the exact same link registers as visited, both immediately and on subsequent refreshes. I'm not sure if this is unique to jQuery Mobile (where I first encountered it) or whether it's a browser limitation that I didn't know about? 回答1: You probably need to change the location.hash if you want it to work with history and visited links styling. Keep in mind that the visited

Gatsby.js: Navigating with URL Parameters and the Browser Back / Forward Buttons

给你一囗甜甜゛ 提交于 2019-12-07 02:21:35
问题 I have an Articles component which displays a list of posts. The list is paginated so that a maximum of 10 posts can display per page. There is a "Next Page" button that when clicked will update the component state and the corresponding url parameter like so: page 1: /news page 2: /news?page=2 page 3: /news?page=3 ...and so on. The way the constructor() and render() methods are set up, it will read this URL parameter and display the correct posts if the user navigates directly to /news?page=3

binding popstate event not working

十年热恋 提交于 2019-12-07 01:34:00
问题 I have tried to type this code into the browser's console: window.onpopstate = function() {alert(1);} and then click the back button. No alert has shown. Am I doing something wrong? Or is it not allowed to bind popstate event to a page from console? Using Chrome 24 and Firefox 18 回答1: Type this into the console window.onpopstate = function() {alert(1);}; history.pushState({}, ''); then click the back button. 回答2: I prefer adding the popstate listener as follows, to prevent overwriting of what

How do I preserve dom state in the browser history after dynamic dom manipulation?

霸气de小男生 提交于 2019-12-06 21:51:06
问题 Is there a general purpose solution for preserving dom state so that when a user returns to a page by using back/forward, the whole page is in the exact state that they left it? This post asks and answers why the behavior is inconsistent with different browsers and different javascript libraries... Ajax, back button and DOM updates ...but I am curious if anyone has a general solution to this problem that doesn't require reloading the page. 回答1: I'm afraid there isn't, and there really can't

HTML 5 - Ajax popstate and pushstate

て烟熏妆下的殇ゞ 提交于 2019-12-06 13:18:38
问题 I am trying to figure out how to use this pushstate and popstate for my ajax applications. I know there are some plug ins but i am trying to learn how to use it in it's raw form at the moment. I am also aware that in the raw form it is not supported by IE. All that aside, I need some help understanding how to use it. the pushstate portion of it is pretty simple. Right now i have: function loadForm(var1,var2){ string = "xyz="+var1+"&abc="+var2; history.pushState("", "page 1", string); } This

getting the default and chrome browsers in android

依然范特西╮ 提交于 2019-12-06 12:41:46
问题 I have a code that retrieve the history of the default browser in android, lately I added the chrome browser history. But I have a problem- I get only the chrome history. E.g. if there is no chrome, I get the default browser, if there is chrome, both methods get the chrome only history. I use this code- String[] mProjection = { Browser.BookmarkColumns.BOOKMARK, BookmarkColumns.CREATED, BookmarkColumns.DATE, BookmarkColumns.TITLE, BookmarkColumns.URL, BookmarkColumns.VISITS, BookmarkColumns.