browser-history

Ajax with history.pushState and popstate - what do I do when popstate state property is null?

早过忘川 提交于 2019-12-04 10:01:27
问题 I'm trying out the HTML5 history API with ajax loading of content. I've got a bunch of test pages connected by relative links. I have this JS, which handles clicks on those links. When a link is clicked the handler grabs its href attribute and passes it to ajaxLoadPage(), which loads content from the requested page into the content area of the current page. (My PHP pages are set up to return a full HTML page if you request them normally, but only a chunk of content if ?fragment=true is

Getting the current URL in an Android browser

血红的双手。 提交于 2019-12-04 09:49:51
问题 I'm searching for a way to get the current URL a user is visiting on the android browser application. I figured out that I can get the last visited URL from the Browser.BOOKMARKS_URI database using the following technique: Cursor cursor = context.getContentResolver().query(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, Browser.BookmarkColumns.DATE + " DESC"); cursor.moveToNext(); String url = cursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX); cursor.close(); The problem

Update browser's URL without reloading the page

…衆ロ難τιáo~ 提交于 2019-12-04 08:35:08
问题 Is it possible to change the URL shown in the browser's address bar without having the browser go to that page? Such as, for example, after updating a page's content via an AJAX call? My understanding is that this is not possible, which is why sites such as twitter and facebook update the hash-tag on ajax calls. That is until today, when I went on http://8tracks.com/ and started to play with the filter on the right hand side... turning different genres on and off, I noticed that even though

Is there a way in History.js to know when the back button was pressed

我只是一个虾纸丫 提交于 2019-12-04 08:02:12
I've started to test History.js . After understanding how it works and that there is no popstate , instead there is statechange . I'm looking for a way to differ when the back button of the browser has been pressed. The reason is that I need to know the URL before the state moved, from the one I'm going to. With the gist the project includes, only the URL we go to is looked. I hope the solution is not to track latest URL visited in a global variable. Thanks I found the solutions on github to be a bit overdone for my purposes. I created a bool that is always true except right before when I used

How to get browsing history using history API in Chrome extension

耗尽温柔 提交于 2019-12-04 06:45:43
How can I get the URLs of recently visited tabs using chrome.history API, specifically, the last 10 URLs visited? Pass an empty string as your query to the search() method of the chrome.history API . For example, this will log the 10 most recently visited URLs to the console: chrome.history.search({text: '', maxResults: 10}, function(data) { data.forEach(function(page) { console.log(page.url); }); }); 来源: https://stackoverflow.com/questions/24894627/how-to-get-browsing-history-using-history-api-in-chrome-extension

History API html5, how to know when user clicked in next/back browser buttons? [duplicate]

时间秒杀一切 提交于 2019-12-04 04:02:36
This question already has an answer here: Is there a way to tell what direction the state is going with history.js? 2 answers I am getting familiar with the html5 History API, but I am using history.js to extend the compatibility, I have one question and it's that, how can I know in: History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate var State = History.getState(); // Note: We are using History.getState() instead of event.state /* Condition here to know if this change is a back or next button, and wich one?? */ }); This is my "whole"

Backbone.history.start() blocks back button from leaving the page

萝らか妹 提交于 2019-12-03 20:23:42
I've run into this on a few apps now, so I wonder if I'm doing something wrong with Backbone history. Here's the situation... I have two pages, let's say: index.html app.html The index page is just a normal, flat HTML page with a link to app.html . On the App page, Backbone.history.start() is called to fire up hash state management, which is used to toggle between two views on the App page, say: app.html#search app.html#results So, navigating back and forth between the #search and #results pages works great. No problems there. The issue occurs when you try to use the back button to step all

Delete browser history using jQuery

好久不见. 提交于 2019-12-03 14:08:53
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 record. So, I would like to ask, is it possible to remove the latest browser record from javascript? or

Selective history.back() using Backbone.js

瘦欲@ 提交于 2019-12-03 13:38:34
问题 I have a Backbone app. I'm using Backbone.history to enable use of the back button. We have a page (settings) that auto loads a popup requiring input from the user. If the user chooses cancel, I want to go back to the previous page. I can do this using window.history.back(). The problem is, if the user went directly to that page (app#settings) from another url (like google) by typing the url into the browser, I want to redirect the user to the home page (app/) rather than going back to google

Angular 2: Prevent router from adding to history

别说谁变了你拦得住时间么 提交于 2019-12-03 12:32:38
问题 We have a client that is iFraming in our app to their website. They don't want the router navigation within our app to affect the back button navigation for their own site. We've tried a couple methods including using post messages to try and have the iFrame communicate with the parent window whenever a history.back() is triggered. My question is if there is any easy way to not affect the browser's history when using Angular 2's router. As far as I know, I couldn't find anything within