pushstate

history.pushState disappears in IE 11

五迷三道 提交于 2019-12-07 15:02:12
问题 There is a site http://www.pionart.pl which is a good illustration of the problem I have with the current site I develop with almost the same code/CMS When I enter the site with IE 11, the browser forgets half of the history methods, incl. history.pushState() (you can easily check it by invoking the console with F12 and typing history.) When I enter http://stackoverflow.com in the same tab, IE suddenly remembers all the methods back. The question: what is the purpose of the "forgetting"? How

is Pushstate inferior to Hashbangs when it comes to caching?

别来无恙 提交于 2019-12-07 09:51:35
问题 There are several advantages to the HTML5 Pushstate in comparison to hasbangs, in fact, Google is now encouraging the use of Pushstate. The only Pushstate disadvantage being publicly discussed is the fact that non-modern browsers do not support it. However, to me it seems that Pushstate is also disadvantageous when it comes to caching. I might be wrong, hence this question. is Pushstate inferior to Hashbangs when it comes to caching pages? Here is a case where it seems that Pushstate is bad

What js should I use to handle back button clicks while using onPopState and pushState

假如想象 提交于 2019-12-07 07:58:50
问题 I'm using pushState to change the url of a website: history.pushState("", "info", "/info"); Which works great, but now the back button doesn't work. I believe I need to write my own back and forward button behavior using onPopState that goes through the history stack and renders the appropriate page. The trick is that when "back" is Null, it should do the thing that the back button normally would do (go "back" to the page before the user entered my site). This seems like pretty standard

Backbone.js change url without reloading the page

感情迁移 提交于 2019-12-07 01:22:58
问题 I have a site that has a user page. On that page, there are several links that let you explore the user's profile. I'd like to make it so that, when one of those links is clicked on, the url changes, but the top third of the page containing the user's banner doesn't reload. I'm using Backbone.js I have a feeling that I'm in one of those situation where I have such a poor understanding of the problem I'm dealing with that I'm asking the wrong question, so please let me know if that appears to

使用pushState实现微信“返回”按钮控制单页应用页面的无刷新跳转

谁说我不能喝 提交于 2019-12-06 21:18:37
相信很多微信开发者都会遇到过这样的问题:为了提高用户体验,把多个页面内容放在一个HTML页面进行展示,通过display属性以及transition动画来实现页面的跳转动画,但是点击微信顶部的“返回”按键之后就会直接跳出整个页面。 所以针对以上的情况,一般的应用的解决方案都是在页面的顶部自己画一个导航栏,需要点击自定义的导航栏来实现返回效果。 弊端 但是不觉得和微信的导航栏放在一起,并且微信上面也有返回,两个返回很别扭吗? 并且对于安卓用户来说,底部的返回键岂不是没用了?万一手抖点到了怎么办? 没关系,使用history可以解决: History 我们知道,浏览器的跳转以及返回都是存在history历史里面的,它是栈,后进先出。 跳转一个新页面就进栈一个,返回一次就出栈一个。所以我们可以控制它的栈来实现返回的效果 pushState history提供了一个方法pushState,可以手动的添加页面进栈。 使用语法:history.pushState(state, title, url); state:Object,与要跳转到的URL对应的状态信息。 title:页面名字,方便调试。 url:要跳转到的URL地址,不能跨域,对于单页应用来说没用,传空即可。 如: history.pushState({ "page": "productList" }, "首页", "");

HTML5 History API

≯℡__Kan透↙ 提交于 2019-12-06 21:18:23
引言 HTML5 History API 为开发者提供在不刷新浏览器页面的情况下修改 URL 的能力,在这之前,如果开发者修改 url 就会全页面刷新。History API 可以让我们灵活控制浏览器地址栏线上的内容,为我们的开发提供了更多的便利。在今天,单页面应用大行其道,除了 ajax 技术之外,History API 也功不可没,它为我们提供了更友好的地址栏接口,让地址栏地址更可读。 History 对象 在浏览器的控制台中,查看history,我们可以看到 History 为我们提供的属性和方法。 属性 history.lenght 历史回话个数,这个个数包括当前页,当打开一个浏览器的空白页面时,history.lenght = 1。 history.state 当前回话的 state,state 可以是任意类型,它有 history.pushState 或 history.replaceState 的第一个参数定义。 方法 history.go([number]) 浏览器前进或回退指定步骤。参数小于 0 时,浏览器回退指定的步骤,参数大于 0 时,浏览器前进指定的步骤。如果参数值太大或者太小时,方法无效果。 history.back() 浏览器回退到前一个页面。相当于点击浏览器的回退按钮。等价于 history.go(-1) 。 history.forward()

HTML 5 - Ajax popstate and pushstate

て烟熏妆下的殇ゞ 提交于 2019-12-06 13:18:38
问题 I am trying to figure out how to use this pushstate and popstate for my ajax applications. I know there are some plug ins but i am trying to learn how to use it in it's raw form at the moment. I am also aware that in the raw form it is not supported by IE. All that aside, I need some help understanding how to use it. the pushstate portion of it is pretty simple. Right now i have: function loadForm(var1,var2){ string = "xyz="+var1+"&abc="+var2; history.pushState("", "page 1", string); } This

Check if user logged in on ajax page change

别等时光非礼了梦想. 提交于 2019-12-06 12:00:55
问题 As part of a webapp I'm building I'll need to check if the user is logged in whenever they change page. On a normal non-ajax site this is easy because I can just place the PHP session conditional statement in the header, and the header being called on every page change will determine whether the login page is displayed or not, but seeing as the header file is only set once within an ajax application, which is on the initial load, how can I check whenever the user makes an ajax page request

Starting Node.js server w/ Gulp “connect” breaks on live reload (Angular app w/ html5 mode)

China☆狼群 提交于 2019-12-06 05:15:18
I'm trying to solve a problem that's been bugging me for awhile. The Scenario: The problem is when I use Gulp to start up my local server w/ Live Reload. It starts up my Angular app just fine, but when I make a file change Live Reload (page refreshes) breaks my app and gives me a "CANNOT GET" because my server.js (node server) file has a special way that it redirects the user to my "index.html" file. The reason for this is because I have "HTML5 mode" enabled in the Angular app (for pretty URL's) and I have to specify this in the server.js file for it to properly work. Before I turned "html5 on

AngularJS: Relative link paths are broken when html5mode(true) is on

倾然丶 夕夏残阳落幕 提交于 2019-12-06 03:57:18
问题 I've been searching and I've found "solutions" to this problem, yet I still can't get this to work right. The Scenario: I'm building an Angular (version 1.2) website with the UI Router and running it on a Node server on localhost. I'm trying to make it have "pretty" url's with the $locationProvider and by turning html5(true) on. My website works fine when clicking through it, but when I try to navigate to a relative link path or refresh the link path the page breaks. I also intend to deploy