browser-history

JavaScript: Navigate to a new URL without replacing the current page in the history (not window.location)

[亡魂溺海] 提交于 2019-12-11 07:03:01
问题 I know how to use window.location. The problem is that, (at least in FF) it erases the page you are on from the history. e.g., I'm on page A, I navigate to B and window.location is used to send me to C. If on page C, I click back, I end up at A, not B. Is there some other way to navigate to another page without erasing the current page from the history? EDIT: This wont happen if you run the code in Firebug. Here is a super simple page (yes I know the code is ugly, it's not the real code) that

Back-Forward buttons of browser are showing weird behaviour. History.js

倖福魔咒の 提交于 2019-12-11 05:37:31
问题 I have a <select> tag. On changing the selected item, some <div> s are updated using AJAX via the functions: update_div1, update_div2, update_div3 . The code managing this operation is below and working well: $('select.select-x').change(function(e) { e.preventDefault(); var value = $('select.select-x option:selected').val(); var text = $('option:selected').text(); update_div1(value); update_div2(value); update_div3(value); manage_history(value,text); return false; }); The problem is in the

Browser back button redirecting to previous page and appending the route to url each times, routing is done with angulrjs

吃可爱长大的小学妹 提交于 2019-12-11 04:27:14
问题 the below Url shows the books listing of a user under a tenant xxtenant in the following url http://localhost:5306/xxtenant#/mybooks the route configuration for the above is below, $routeProvider.when('/mybooks', { templateUrl: '/partials/mybooks.html', controller: 'mybooksCtrl', resolve: { //code to check tokens } }) the listing page i have one button to edit the book details, if i click the button the browser will redirect to http://localhost:5306/xxtenant#/editbook/7190/edit/saved

Can I use onpopstate with IE?

馋奶兔 提交于 2019-12-11 03:44:29
问题 I'm currently (happily) using jquery to bind a ajax request function to the window.onpopstate event in non-IE browsers. However, IE never hits my doAjax function. // Bind a function to the popstate event to execute ajax requests // this allows request to occur on back/fwd browser navigation window.onpopstate = doAjax; Anyone know if there's a way to make IE 8/9 play nice somehow? 回答1: The solution I have arrived at is to bind both onpopstate and onhashchange to the desired handler. //

history.pushstate jquery back button not loading prev content

冷暖自知 提交于 2019-12-11 03:15:43
问题 I am trying to implement history.pushstate with jQuery as described This is the following code I have: container = $(".loadContent"); currentItem = null; $(".list-group a").each(function (index) { var item = $(this); if (item.hasClass("active")) { currentItem = item; } item.on("click", function(e) { e.preventDefault(); history.pushState({}, '', $(this).attr("href")); $(".heightDiv").css("height", divheight); if (currentItem == item) return; $(".content").empty(); $(".loading").css("height",

Chrome.history.getVisits returning empty set, even though item exists in Chrome.history.search

丶灬走出姿态 提交于 2019-12-11 01:54:11
问题 I'd like to collect my past N history items, and then find the time stamp of all times I've visited that page going back as far as my chrome history contains. Chrome.history.search allows me to get the urls of my last N history items. However, if I now call Chrome.history.getVisits on each of those urls, some return '[]', even though they exist in my history. Furthermore, searching for the URL in chrome://history returns the item properly, even though the getVisits call returns []. One

How to configure a basename in React Router 3.x

半城伤御伤魂 提交于 2019-12-11 01:14:20
问题 I have an app running at a nested url as opposed to the root. Lets say example.com/app . I read here that in react router 2.x you could configure basenames. How can this be done in react router 3.x? FYI I am also using the react-router-redux package. 回答1: This functionality does not exist in React Router anymore. I went through a similar problem and found this fix. Step 1: Install History (3.0.0) npm install --save history@3.0.0 Step 2: Import { useBasename } from history in your router file

Minimum nodejs server setup needed for React using react-router and browserHistory

不打扰是莪最后的温柔 提交于 2019-12-11 00:14:06
问题 My current server.js: let express = require('express'); let harp = require('harp'); let path = require('path'); let app = express(); app.use(express.static(__dirname + "/dist")); app.use(harp.mount(__dirname + "/dist")); let port = process.env.PORT || 3333; app.listen(port, () => console.log("Listening on port " + port) ); // ... other routes for data fetching ... // For browserHistory: https://github.com/reactjs/react-router/blob/1.0.x/docs/guides/basics/Histories.md app.get('*', (req, res)

How to modify history as facebook's photo viewer does?

烈酒焚心 提交于 2019-12-10 20:53:38
问题 I have a popup modal on my website similar to facebook's photo viewer. When the modal is opened, it is displaying content from another page and I want to change the address bar value and history to show this. There is a dropdown in the modal that changes the content in the modal to that of a different page. When this happens, I once again want to change the address bar value and history to show the page was changed. Essentially, I want to exactly replicate the behavior of facebook's photo

Mozilla Firefox form values reset on history.back

社会主义新天地 提交于 2019-12-10 18:08:35
问题 I'm writing a PHP script. I've got a form uses post method and action to another page. If an error occurs, I show a message on that target page, and let the user go back via a link that triggers history.back(); javascript function. So user clicks that link and turns back to the page includes form and values entered by user should remain in inputs. They stay on Chrome, but lost in Firefox. Is there a way to keep DOM information on all major browsers using history, or is the only way to do that