pushstate

pushState: what exactly is the state object for?

一个人想着一个人 提交于 2019-11-28 16:29:50
I've read a dozen of times now that the state object could exists of multiple key|value pairs and that it is associated with the new history entry. But could someone please give me an example of the benefits of the state object? Whats the practical use of it? I can't imagine why not just typing in {} janfoeh Take this small example: run fiddle ( editor view ): You have a page where a user can select a color. Every time they do, we generate a new history entry: function doPushState(color) { var state = {}, title = "Page title", path = "/" + color; history.pushState(state, title, path); }; We

Account for Backbone.js pushState routes with node.js express server?

此生再无相见时 提交于 2019-11-28 15:54:25
问题 pushState support was introduced with Backbone.js' version 0.5 update. From the backbone documentation: Note that using real URLs requires your web server to be able to correctly render those pages, so back-end changes are required as well. For example, if you have a route of /documents/100, your web server must be able to serve that page, if the browser visits that URL directly. For full search-engine crawlability, it's best to have the server generate the complete HTML for the page ... but

popstate returns event.state is undefined

二次信任 提交于 2019-11-28 11:53:33
I am learning about history in HTML5, in this example (open the JavaScript browser console to see error) the event.state.url returns: Uncaught TypeError: Cannot read property 'url' of undefined Look and help: http://jsfiddle.net/un4Xk/ event is the jQuery event object, not the DOM one. To access the DOM event object, use event.originalEvent : http://jsfiddle.net/pimvdb/un4Xk/1/ . var state = event.originalEvent.state; Remember that the state is only defined when the new state has data, so it is not available when clicking and then going back to the initial state: initial state link to state 1

AngularJS HTML5Mode

坚强是说给别人听的谎言 提交于 2019-11-28 11:13:00
I am using HTML5 mode in my angular app to turn off hashbangs and that is because I am going to be providing URLs for my users like: http://myapp.com/nicklewis Rather than: http://myapp.com#/nicklewis The latter works but it isn't ideal for vanity URLs. So short of writing my own NodeJS app to resolve this issue, is there anything in Firebase I could make use of or not? jeff Firebase just had a recent update that included this functionality. You can use it like so in your firebase.json: "rewrites": [ { "source": "**", "destination": "/index.html" } ] This is the code sample used in their docs

Using HTML5 pushState() in IE9

我的未来我决定 提交于 2019-11-28 08:57:57
Is there any way to use HTML5 History API ( pushState ) in IE9? If there is a solution for all other browsers that would be great! amosrivera History.js Quote from the repo: History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality. As per Ember

Angularjs vs SEO vs pushState

杀马特。学长 韩版系。学妹 提交于 2019-11-28 08:53:16
问题 After reading this thread I decided to use pushstate api in my angularjs application which is fully API-based (independent frontend and independent backend). Here is my test site: http://huyaks.com/index.html I created a sitemap and uploaded to google webmaster tools. From what I can see: google indexed the main page, indexed the dynamic navigation (cool!) but did not index any of dynamic urls. Please take a look. I examined the example site given in the related thread: http://html5

Configure IIS server to work with Aurelia framework and push state

强颜欢笑 提交于 2019-11-28 07:13:40
问题 I have created a basic aurelia app starting from this repo and I was trying to get rid of the # (hashtag) in the URL bar. I have 2 projects, one running WebApi on a machine and one running an empty web project (not MVC) on another machine. On the official documentation website it only says how to configure your routes but my project is not MVC oriented. How can I configure the IIS server from Web.config in a sense that when I access http://localhost/home it should start the aurelia framework

window.history.pushState refreshing the browser

你。 提交于 2019-11-28 05:46:51
I am working on some javascript code, and using window.History.pushState to load new HTML pages, instead of using href tags. My code (which is working fine ) looks like this. window.History.pushState({urlPath:'/page1'},"",'/page1') strangely, this fails , ie reloads the browser window.History.pushState({urlPath:'/page2.php'},"",'/page2.php') But this works , content is updated, browser not refreshed ! (notice the URL is absolute and not relative) window.History.pushState({urlPath:'www.domain.com/page2.php'},"",'www.domain.com/page2.php') The documentation for window.History.pushState says that

Backbone.js PushState True

拥有回忆 提交于 2019-11-28 05:43:02
问题 I've created a site in backbone and for various reasons I've decided I want to remove the hash in the URL. I've changed history.start from Backbone.history.start(); to Backbone.history.start({pushState: true, root: '/'}); but once I do that the routing stops working correctly. My routing looks like this: var Router = Backbone.Router.extend({ routes: { "": "home", "home": "home", "artists": "artists", } }); var router = new Router; router.on('route:home', function() { console.log("home"); //

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

点点圈 提交于 2019-11-28 04:54:31
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 the History API, you should see the URL in the location bar change to /0, /1, etc., every second. On