html5-history

It is possible to set the href attribute of a base tag in AngularJs?

…衆ロ難τιáo~ 提交于 2019-12-04 05:24:19
I want to set the href attribute value of base tag based on a constant value. To do so I've declared the base attribute in the head element as follows: <head> <base ng-href="{{baseUrl}}"> </head> and I set the baseUrl value with this code snippet: app.run(["$rootScope","env", function($rootScope, env){ $rootScope.baseUrl = env.baseUrl; }]); where env is the Angular constant. The locationProvider is configured in this way: .config(function ($locationProvider) { $locationProvider.html5Mode(true); }) When I run it I see the value set correctly: <base ng-href="/" href="/"> but in the console I get

Set URL parameters without causing page refresh

主宰稳场 提交于 2019-12-04 03:07:48
How can you set URL parameters using History.pushState() to avoid browser refreshes? If there is a not a simple JS solution, is there already a popular library or built in function for jQuery? Here is a relevant SO question, where the accepted answer does not actually work according to comments & my test (it removes the query string instead of updating a value): history.pushState() change query values Just to be clear, I am referring to the URL parameters in a query string: http://google.com/page?name=don so we could change don to tim without causing a reload. Here is one possible solution I

history pushState and scroll position

大憨熊 提交于 2019-12-03 23:23:25
I am trying to retrieve the scroll position when a user navigates back in the browser history using HTML5 popstate handler. Here is what I have: $(document).ready(function () { $(window).on('popstate', PopStateHandler); $('#link').click(function (e) { var stateData = { path: window.location.href, scrollTop: $(window).scrollTop() }; window.history.pushState(stateData, 'title', 'page2.html'); e.preventDefault(); }); }); function PopStateHandler(e) { alert('pop state fired'); var stateData = e.originalEvent.state; if (stateData) { //Get values: alert('path: ' + stateData.path); alert('scrollTop:

Facebook chatbox doesn't reload between pages

自闭症网瘾萝莉.ら 提交于 2019-12-03 15:23:07
I observed this feature in Facebook, that when you have a chat box opened at the bottom right, and you go to another page, say, your friend's profile, or some photo collection page within Facebook, the chat box doesn't reload, it remains where it is (as if in a separate layer on top of the background page). So naturally, I thought that Facebook isn't reloading the page per se, it is using history.pushstate and related functions to load the content asynchronously, and changing the URL dynamically (Firebug confirmed it, if you click on one of your friend's name and is taken to your friend's

Page title is not changed by history.pushState

混江龙づ霸主 提交于 2019-12-03 10:32:48
问题 I've just opened a blank HTML page with some little amount of base tags (like html, body, head, etc) in Google Chrome, and tried to execute the following command in console: history.pushState(null, 'my test title', '/test/url'); History events work fine, but the page title stays unchanged. Is it OK? Should I change it manually every time? If I should, why there is such parameter in pushState() method like title? 回答1: It seems current browsers don't support pushState title attribute. You can

Detect whether HTML5 History supported or not

纵饮孤独 提交于 2019-12-03 08:10:44
问题 How can I check if the browser you are using supports the HTML5 history api? As you can see here http://caniuse.com/#search=history only chrome +ff4 and several others supports this and I wish to do something else if they cant support this. How can I make some kind of an if statement for this checking? 回答1: if (window.history && window.history.pushState) See also this All-In-One Almost-Alphabetical No-Bullshit Guide to Detecting Everything 回答2: You can detect support for history management

Restoring content when clicking back button with History.js

£可爱£侵袭症+ 提交于 2019-12-03 06:04:26
问题 I've implemented History.js on a local test application. Everything seems to work, however if I press the back button in the browser, the previous content does not get restored. Do I actually have to load the content manually again (i.e. make another ajax call) when user presses the back button? Then how does github do it? I see they don't make another ajax call when clicking back button in the code tree. Here is my code: History.Adapter.bind(window,'statechange',function() { var State =

Change URL without refresh the page [duplicate]

萝らか妹 提交于 2019-12-03 03:15:56
问题 This question already has answers here : How do I modify the URL without reloading the page? (19 answers) Closed last year . I would like to replace an url without page refresh. I need to change: https://example.com/en/step1 to https://example.com/en/step2 How to do that ? 回答1: Update Based on Manipulating the browser history, passing the empty string as second parameter of pushState method ( aka title ) should be safe against future changes to the method, so it's better to use pushState like

Page title is not changed by history.pushState

那年仲夏 提交于 2019-12-03 01:04:22
I've just opened a blank HTML page with some little amount of base tags (like html, body, head, etc) in Google Chrome, and tried to execute the following command in console: history.pushState(null, 'my test title', '/test/url'); History events work fine, but the page title stays unchanged. Is it OK? Should I change it manually every time? If I should, why there is such parameter in pushState() method like title? It seems current browsers don't support pushState title attribute. You can easily achieve the same thing by setting it in JS. document.title = "This is the new page title."; Following

Detect whether HTML5 History supported or not

被刻印的时光 ゝ 提交于 2019-12-02 21:47:37
How can I check if the browser you are using supports the HTML5 history api? As you can see here http://caniuse.com/#search=history only chrome +ff4 and several others supports this and I wish to do something else if they cant support this. How can I make some kind of an if statement for this checking? Gaurav if (window.history && window.history.pushState) See also this All-In-One Almost-Alphabetical No-Bullshit Guide to Detecting Everything You can detect support for history management (as well as many other browser features) using Modernizr . if (Modernizr.history) You can use canisuse.js