pushstate

“Single-page” JS websites and SEO

余生长醉 提交于 2019-11-27 05:46:50
There are a lot of cool tools for making powerful "single-page" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and nothing more) and letting the client handle all of the HTML generation stuff. The problem with this "pattern" is the lack of search engine support. I can think of two solutions: When the user enters the website, let the server render the page exactly as the client would upon navigation. So if I go to http://example.com/my_path directly the server would render the same thing as the client would if I go to /my_path through

“Single-page” JS websites and SEO

无人久伴 提交于 2019-11-27 03:58:30
问题 There are a lot of cool tools for making powerful "single-page" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and nothing more) and letting the client handle all of the HTML generation stuff. The problem with this "pattern" is the lack of search engine support. I can think of two solutions: When the user enters the website, let the server render the page exactly as the client would upon navigation. So if I go to http://example.com/my_path

history.pushstate fails browser back and forward button

纵饮孤独 提交于 2019-11-27 03:53:53
问题 I'm using jQuery to dynamically load content in a div container. The server side code detects if the request is AJAX or GET. I want the browsers back/forward buttons to work with the code so I try to use history.pushState. I've got to following piece of code: $('.ajax').on('click', function(e) { e.preventDefault(); $this = $(this); $('#ajaxContent').fadeOut(function() { $('.pageLoad').show(); $('#ajaxContent').html(''); $('#ajaxContent').load($this.attr('href'), function() { window.history

How do I retrieve if the popstate event comes from back or forward actions with the HTML5 pushstate?

北城余情 提交于 2019-11-27 03:42:33
I'm developing a webpage where depending on the next or back actions I do the correspondent animation, the problem comes when using the pushstate. When I receive the event how do I know if the user clicked back or forward history buttons using the Pushstate API?, or do I have to implement something myself? You must implement it yourself which is quite easy. When invoking pushState give the data object a unique incrementing id (uid). When onpopstate handler is invoked; check the state uid against a persistent variable containing the last state uid. Update the persistent variable with the

How to trigger change when using the back button with history.pushstate and popstate?

北战南征 提交于 2019-11-27 03:11:21
I'm pretty much a novice when it comes to js so I'm sorry if I'm missing something really simple. Basically, I've done some research into using the history.pustate and popstate and I've made it so a query string is added to the end of the url ( ?v=images ) or ( ?v=profile )...( v meaning 'view') by using this: var url = "?v=profile" var stateObj = { path: url }; history.pushState(stateObj, "page 2", url); I want to make it so I can load content into a div but without reloading the page which I have done using the .load() function. I then used this code: $(window).bind('popstate', function

Using HTML5 pushState() in IE9

℡╲_俬逩灬. 提交于 2019-11-27 02:32:28
问题 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! 回答1: 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

window.history.pushState refreshing the browser

£可爱£侵袭症+ 提交于 2019-11-27 00:57:20
问题 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

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

点点圈 提交于 2019-11-27 00:42:32
问题 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

How to handle facebook sharing/like with hashbang urls?

妖精的绣舞 提交于 2019-11-26 22:43:59
问题 I am building a website where from the homepage i will open some other URI on the website into a lightbox (AJAX), and i want to use HTML5 push state and hash bangs as a fallback to manage changes of states. Now i want the urls to be crawlable and Facebook shareable/likeable.. If the user browser supports HTML5 push state, no problem, he can share the URL (for example : http://myserver/example ) and Facebook will find the appropriate OG metas in the static content. But if the user uses a HTML4

SecurityError: The operation is insecure - window.history.pushState()

≯℡__Kan透↙ 提交于 2019-11-26 22:19:56
I'm getting this error in Firefox's Console: SecurityError: The operation is insecure and the guilty is HTML5 feature: window.history.pushState() when I try to load something with AJAX. It is supposed to load some data but Javascript stops executing on error. I'm wondering why this may be happening. Is this some server misconfiguration? Any help would be appreciated. UPDATE: Yes, it was a server error with domain name not matching: http://en.wikipedia.org/wiki/Same-origin_policy Matt Make sure you are following the Same Origin Policy . This means same domain, same subdomain, same protocol