browser-history

Is monitoring location.hash a solution for history in XHR apps?

别来无恙 提交于 2019-11-27 04:23:41
问题 As is well known, in XHR (aka AJAX) web applications no history for your app is build and clicking the refresh button often moves the user out of his/her current activity. I stumbled upon location.hash (e.g. http://anywhere/index.html#somehashvalue ) to circumvent the refresh problem (use location.hash to inform your app of it's current state and use a page load handler to reset that state). It's really nice and simple. This brought me to thinking about using location.hash to track the

history.pushstate fails browser back and forward button

纵饮孤独 提交于 2019-11-27 03:53:53
问题 I'm using jQuery to dynamically load content in a div container. The server side code detects if the request is AJAX or GET. I want the browsers back/forward buttons to work with the code so I try to use history.pushState. I've got to following piece of code: $('.ajax').on('click', function(e) { e.preventDefault(); $this = $(this); $('#ajaxContent').fadeOut(function() { $('.pageLoad').show(); $('#ajaxContent').html(''); $('#ajaxContent').load($this.attr('href'), function() { window.history

How do I retrieve if the popstate event comes from back or forward actions with the HTML5 pushstate?

北城余情 提交于 2019-11-27 03:42:33
I'm developing a webpage where depending on the next or back actions I do the correspondent animation, the problem comes when using the pushstate. When I receive the event how do I know if the user clicked back or forward history buttons using the Pushstate API?, or do I have to implement something myself? You must implement it yourself which is quite easy. When invoking pushState give the data object a unique incrementing id (uid). When onpopstate handler is invoked; check the state uid against a persistent variable containing the last state uid. Update the persistent variable with the

form POST in iframe without affecting history

大城市里の小女人 提交于 2019-11-27 02:49:33
问题 Is it possible to submit a form inside an iframe without affecting the browser's history? I've implemented sending a cross domain POST request. It uses Javascript to create and submit a form inside an iframe. It works, but each request adds an item to the browser's history. Anyone know a way around this? I've tried creating the iframe with both innerHTML and createElement. I've seen no difference so far. PS - I would love to use XMLHtttpRequest ("Ajax"), but it doesn't support sending data

How to get Chrome History & Bookmarks in Android Marshmallow (API>=23)?

混江龙づ霸主 提交于 2019-11-27 01:31:48
问题 Till API Level 22 (i.e. till Lollipop), there has been a way to read History and Bookmarks from the Chrome app (as shown in this thread) using the permission com.android.browser.permission.READ_HISTORY_BOOKMARKS . Now, in Android API=23 Marshmallow, since the entire Browser Bookmark system has been removed in Marshmallow (changes here), the above method does not work anymore. Here is the thread that shows why this is not possible anymore. In my research so far, I have not found good news.

Is History API broken on iOS? (Location bar doesn't update on pushState)

点点圈 提交于 2019-11-27 00:42:32
问题 Filing this under the either the I Can't Believe No One Noticed This Before or the I Must Be Missing Something categories: It appears that if you do a simple window.history.pushState on iOS, the location bar doesn't update unless it is in response to a user gesture. The state itself does get pushed (as you can see by hitting the back button button). Here's is the tiniest test-case I could come up with recreate the issue: http://thelink.is/history-api-ios-bug On a desktop browser that supports

History.Back with refresh

我的梦境 提交于 2019-11-27 00:37:35
问题 I would like to have the History.back(); functionality with a complete refresh of previous page. Any idea how to do that (and make it work in IE, FF and Chrome). 回答1: You could redirect (by window.location) to document.referrer i.e. window.location.href = document.referrer; Internet Explorer fix for passing referrer to a particular location: if(IE){ //IE, bool var, has to be defined var newlocation = document.createElement('a'); newlocation.href = URLtoCall; document.body.appendChild

jQuery History Plugin

…衆ロ難τιáo~ 提交于 2019-11-27 00:31:10
问题 There are a few different jQuery history plugins out there is one better than any of the others... I'm trying to decide which one to go with, any thoughts or any others to try: http://www.balupton.com/projects/jquery-history http://tkyk.github.com/jquery-history-plugin http://plugins.jquery.com/project/history 回答1: I'm not exactly sure what you are trying to do, but I'm assuming you want to use hash tags to control page loads like Twitter and Facebook. If that's the case check out this post:

How do I use window.history in JavaScript?

家住魔仙堡 提交于 2019-11-26 21:52:20
问题 I found a lot of questions about this on Stack Overflow, but they were all very specific about certain parts. I did find this question whose answers provide some nice references, but they don't actually explain how it all works, and their examples hardly do anything. I want to know more about how it all works together, and I want to use vanilla JavaScript. (Also, many of the answers on other questions are years old.) 回答1: GETTING STARTED First of all, you can remove the window part. Just

Does Android support window.location.replace or any equivalent?

风格不统一 提交于 2019-11-26 21:46:58
问题 It seems that the Android browser doesn't properly implement window.location.replace . In most browsers, calling window.location.replace will replace the current URL with the URL passed to it. When the user navigates somewhere else then clicks back, they'll be returned to the URL that was passed to window.location.replace , rather than the URL that they were at before window.location.replace was called. The Android browser doesn't seem to implement this properly. In the Android browser, the