html5-history

Does Firefox handle window.onpopstate differently than Chrome and Safari?

老子叫甜甜 提交于 2019-12-11 14:49:28
问题 I've been trying to get a single page application working on Chrome, Safari and Firefox but Firefox doesn't seem to be executing the window.onpopstate at all. window.onpopstate = function() { fullpath = location.pathname; console.log(fullpath); } I have .htaccess routing all requests back to index.html so when the the client makes a request, the browser stores the url as a javascript variable and passes it through the js in index.html When run in firefox, the variable isn't passed to the

YouTube not triggering history.pushState

て烟熏妆下的殇ゞ 提交于 2019-12-11 03:57:23
问题 I'm trying to detect a page change on YouTube by using history.pushState , but it never seems to trigger. I ultimately want to get this working from a Tampermonkey/Greasemonkey script, and for that I understand you need to inject the script into the actual page, which I've done like so, but to no avail: html = "var oldState = history.pushState;"+ "history.pushState = function() {" + "alert('url changed');" + "return oldState.apply(this);" + "}"; var head = document.getElementsByTagName("body"

HTML 5 History API with PopState and AJAX keeps reloading the page

元气小坏坏 提交于 2019-12-11 01:47:31
问题 I'm currently loading data onto the page via Ajax updating the url via pushState , no errors. And popstate returns the full object into the console — for viewing purposes. I'm at the point where the forward and back buttons work partially, meaning, sometimes it will reshow the content when the url changes, but most of the time it simple reloads the page which is stopping the smooth flow of the application. Been working endless trying to get things to work, without success :( I just can't

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

How to change hashbang url to history API

徘徊边缘 提交于 2019-12-09 18:42:10
问题 I'm using ember1.0-rc3, i want to change hashbang urls into normal url format (ie, www.site.com/admin#/page1 to www.site.com/admin/page1).In order to make this change,i use location: "history" in app router. But when i reload a page or bookmark a page doesn't works, it redirects to home page only.I want the options reload and bookmark in my app, without changing redirect urls in .htaccess file.Is there any way for it?Thanks in advance 回答1: In order to use HTML5 history with a single page app

Get previous page phonegap javascript

落花浮王杯 提交于 2019-12-08 20:15:33
How do I get the previous page with javascript on phonegap? I want to go back ( window.history.back() ) only if I come from one specific html file, otherwise I want to go to another html page when back button is pressed. So I want to know which one is the previous page on history. I have been googling for a while and I didn't find an answer that suits for me. caiocpricci2 If you want something built in you can use document.referrer to get the previous URL. But it might not be reliable for your needs. More info here , here and here Another VERY simple option is to store the current page name in

Responding differently to different url changes with history.js

*爱你&永不变心* 提交于 2019-12-08 06:58:44
问题 I'm using history.js, and want to call content via ajax when the url changes. I have that working, but the issue is that I need the page to respond differently depending on what URL is loaded when the state changes. For example, within a local scope, I need the pages related to URLs on the right hand nav to load into the content area next to them. If the URL changes to a scope outside of the section I'm in, I want the ajax call to load pages in a container that contains the whole section,

Handle any default document type in servicestack Html5ModeFeature plugin

拜拜、爱过 提交于 2019-12-07 23:25:18
问题 The code below is an initial pass at a ServiceStack plugin to support the angularjs configuration $locationProvider.html5Mode(true); when servicestack is self-hosted (as requested here: Routing path with ServiceStack and Serving default index.html page when using Angular HTML5mode and Servicestack on the backend). I think I've got a good general solution, with one last question (other than switching this to a Feature naming convention in line with other plugins). How can I generically handle

Should I use an iframe rather than ajax?

大兔子大兔子 提交于 2019-12-06 21:44:11
问题 We're building a Drupal site with an audio player which should keep playing while you browse the page (something like soundcloud). Currently we're loading clicked <a> 's sites with ajax and inject the html into the page and use history.js to manipulate the location. There is a major downside though: Since a newly loaded page may have different css and js on it, we have to compare the current script, style and link elements to the ajax response text (ugly regex) and only add the new, yet non

How to enable offline support when using HTML5 history api

北慕城南 提交于 2019-12-06 12:17:35
问题 What are the best practices (and how to go about doing it) to support offline mode when using html5 history api for url rewrites? For example, (hypothetically) I have a PWA SPA application at https://abc.xyz which has internationalization built in. So when I visit this link, the Vue router (which ideally could be any framework - vue, react, angular etc.) redirect me to https://abc.xyz /en . This works perfectly when I am online (ofcourse, the webserver is also handling this redirect so that