browser-history

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

你。 提交于 2019-11-27 19:26:28
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 of my app. I don't want to use existing libraries, because they use iframes etc. So here's my nickel

Preserve dynamically changed HTML on back button

与世无争的帅哥 提交于 2019-11-27 17:17:31
It's amazing, I constantly see this working in other sites but never in sites that I'm working on. I'm bringing in new content with ajax, I know about history.js and the History API, I do not want to change the URL, just have the browser cache the new HTML content so when a user leaves the page and comes back using the back button, it still has the updated HTML. I see this working all the time in other sites without URL changes or using the hash #. Is there a trick to get it to work or is it randomly decided by the browser? If I don't want to use the URL to have this information, is there an

Javascript history.PushState not working?

北城以北 提交于 2019-11-27 14:21:34
I have this code here: <script type="text/javascript"> function goFunction(){ history.pushState("google.ca", "GOOGLE CANADA", "http://www.google.ca"); return event.preventDefault(); } </script> and <a href="#" onclick="javascript:goFunction();">GO</a> when I click on my link, I get this error in my error log: Uncaught SecurityError: A history state object with URL 'http://www.google.ca/' cannot be created in a document with origin 'http://cowelllaserhair.com'. you can see this at: http://cowelllaserhair.com/test.html What am I doing wrong? Do I need to reference something? Thanks, J The URL

How to modify jQuery mobile history Back Button behavior

廉价感情. 提交于 2019-11-27 11:59:00
问题 I'll start this off with I have researched a bit, but no solution that solves what seems like it should be a simple JQM modification. I have a wine review webapp that has the following view user flow: http://5buckchuck.com/ Wine type > Wine list > Wine Details > Wine review (redirect via django backto ) > Wine Details updated from review What I want to happen is when the user presses the back button it should go back to the wine list. What currently happens is the the Wine Detail view is

JS - window.history - Delete a state

假装没事ソ 提交于 2019-11-27 11:19:20
Using the html5 window.history API, I can control the navigation pretty well on my web app. The app currently has two states: selectDate (1) and enterDetails (2). When the app loads, I replaceState and set a popState listener: history.replaceState({stage:"selectDate",...},...); window.onpopstate = function(event) { that.toStage(event.state.stage); }; When a date is selected and the app moves to stage 2 I push state 2 onto the stack: history.pushState({stage:"enterDetails",...},...); This state is replaced anytime details change so they are saved in the history. There are three ways to leave

How to change the URL displayed in the browser without leaving the page

二次信任 提交于 2019-11-27 08:28:30
Is it possible with JavaScript to change the browser's URL, but not leave the page? In older browsers, you can not change the url in the address bar without leaving the page. But you can change the hash portion of the url without leaving the page. That is to say you can change www.example.com to www.example.com#new_text with JavaScript window.location.hash = "new_text" ; everything after the # can be changed. However, in HTML5 there is a new History API which allows you to change the part of the URL after the domain. So you still cannot change www.example.com to www.BankOfAmerica.com (for

How to handle back button while changing the browser-URL with HTML5 pushState

≯℡__Kan透↙ 提交于 2019-11-27 07:14:54
问题 I’ve made a one page site. When user clicks on the menu buttons, content is loaded with ajax. It works fine. In order to improve SEO and to allow user to copy / past URL of different content, i use function show_content() { // change URL in browser bar) window.history.pushState("", "Content", "/content.php"); // ajax $content.load("ajax/content.php?id="+id); } It works fine. URL changes and the browser doesn’t reload the page However, when user clicks on back button in browser, the url

creating back page links in Codeigniter

只愿长相守 提交于 2019-11-27 06:33:09
问题 I have a page with URL http://arslan/admin/category/index/0/name/asc/10 in Codeigniter. In this URL, the uri_segment start from 0 . This ( 0 ) is the default search value, name and asc are the default sort field and order, and 10 is the pagination index. Now if I move to an add page with URL (http://arslan/admin/category/add/) similarly like above "add" is the current function. Now if i want to go back through a link to back page... How can I divert the user back? I can't make the URL go back

Popstate on page's load in Chrome

淺唱寂寞╮ 提交于 2019-11-27 06:04:28
I am using History API for my web app and have one issue. I do Ajax calls to update some results on the page and use history.pushState() in order to update the browser's location bar without page reload. Then, of course, I use window.popstate in order to restore previous state when back-button is clicked. The problem is well-known — Chrome and Firefox treat that popstate event differently. While Firefox doesn't fire it up on the first load, Chrome does. I would like to have Firefox-style and not fire the event up on load since it just updates the results with exactly the same ones on load. Is

How do i pass state through React_router?

做~自己de王妃 提交于 2019-11-27 05:10:06
问题 Here is the file that's causing me trouble: var Routers = React.createClass({ getInitialState: function(){ return{ userName: "", relatives: [] } }, userLoggedIn: function(userName, relatives){ this.setState({ userName: userName, relatives: relatives, }) }, render: function() { return ( <Router history={browserHistory}> <Route path="/" userLoggedIn={this.userLoggedIn} component={LogIn}/> <Route path="feed" relatives={this.state.relatives} userName={this.state.userName} component={Feed}/> <