News for hackers. Stuff that matters.
Re:HTML5: Changing the browser-URL without refreshing page by MikeW on Wednesday July 21, 2010 @12:00PM (#1535545)
What about all the services offering provider.com/~username.

Scrolling status bars used to be all the range in the 90s, I wonder how long until url hacks allow for scrolling address bars with this.

Re:HTML5: Changing the browser-URL without refreshing page by johnswamps on Wednesday July 21, 2010 @12:39PM (#1535673)
Here you go. Copy paste into your url bar. Only tested in Chrome (edit: apparently also works in safari 5)

javascript:var dashes = ""; var num = 20; while(--num) dashes += "-"; setInterval(function() { window.history.pushState("", "", dashes.slice(0, num % 20) + "foo" + dashes.slice(num % 20)); num++;}, 500)

Re:HTML5: Changing the browser-URL without refreshing page by kiwidrew on Wednesday July 21, 2010 @04:02PM (#1536364)
If you change the window.history.pushState() call to window.history.replaceState(), it doesn't add bazillions of entries to your history, which makes it slightly more practical.

javascript:var dashes = ""; var num = 20; while(--num) dashes += "-"; setInterval(function() { window.history.replaceState("", "", dashes.slice(0, num % 20) + "foo" + dashes.slice(num % 20)); num++;}, 500)

Re:HTML5: Changing the browser-URL without refreshing page by ben_alman on Thursday July 22, 2010 @10:58AM (#1538308)
Ok, here's a first pass... http://jsfiddle.net/cowboy/FB9Nd/show/
Re:HTML5: Changing the browser-URL without refreshing page by e1ven on Wednesday July 21, 2010 @12:48PM (#1535711)
That is simultaneously one of the cooler, and more horrifying things I have seen.

With Great Power, comes great potential for horrible, horrible abuse.

Re:HTML5: Changing the browser-URL without refreshing page by j79 on Wednesday July 21, 2010 @08:49PM (#1537001)
Absolutely. I was thinking this could be "abused" in the same way that animated status bars were in the 90s.

Of course, I had to try it out...

javascript:var s=[119,101,108,99,111,109,101,45,116,111,45,104,97,99,107,101,114,45,110,101,119,115];var c=1;var mod=s.length+1;setInterval(function(){window.history.replaceState("","", setString())}, 200);function setString(){var n="";if(!(c % mod)){c=1}else{c++}for(i=0;i<s.length;i++){n+=String.fromCharCode(s[i]-(s[i]==45||i!=c-1?0:32))}return n+".aspx!!!"};

Re:HTML5: Changing the browser-URL without refreshing page by kristofferR on Wednesday July 21, 2010 @01:58PM (#1535930)
Damn, that is annoying! It totally screws up the back button functionality in Safari:

http://imgur.com/41rrV.png

Re:HTML5: Changing the browser-URL without refreshing page by sorbus on Wednesday July 21, 2010 @03:14PM (#1536205)
That's sort of the point, isn't it? As it's continuously changing the URL ... I could see this used to make it difficult or impossible for people to leave sites, except by closing the window.
Re:HTML5: Changing the browser-URL without refreshing page by mrkurt on Wednesday July 21, 2010 @08:13PM (#1536938)
Haha, indeed! (Don't click this if you care about your history) http://kurtly.tumblr.com/sticky-history
Re:HTML5: Changing the browser-URL without refreshing page by wodow on Wednesday July 21, 2010 @02:35PM (#1536076)
And also in Chrome.
Re:HTML5: Changing the browser-URL without refreshing page by ptomato on Wednesday July 21, 2010 @01:09PM (#1535772)
Also works in Safari 5, at least.
Re:HTML5: Changing the browser-URL without refreshing page by colinprince on Wednesday July 21, 2010 @10:51AM (#1535313)
Can this be abused? Loading a page in a tab, I may not notice the URL changing from wickedsite.com to mybanksite.com, all without a reload.
Re:HTML5: Changing the browser-URL without refreshing page by pepijndevos on Wednesday July 21, 2010 @11:03AM (#1535365)
I don't think you can change the root domain, but I'll have to check that.
Re:HTML5: Changing the browser-URL without refreshing page by j79 on Wednesday July 21, 2010 @11:20AM (#1535422)
You're correct. Only the path (and not the domain) can be changed.

From the article:

* For security reasons, you can only change the path of the URL, not the domain itself. So you can change anything in the URL after my-domain.com/[change-the-stuff-here.html].

Re:HTML5: Changing the browser-URL without refreshing page by d4rt on Wednesday July 21, 2010 @04:36PM (#1536470)
wouldn't this be better if you could only go to the same level or lower, thus preventing server/~user1 pretending to be server/~user2?

does this break real use cases?

Re:HTML5: Changing the browser-URL without refreshing page by novas0x2a on Wednesday July 21, 2010 @04:58PM (#1536533)
Cookies have this problem, too (anyone from the same domain sees your cookies, and you can't really count on the cookie path). So does XMLHTTPRequest. Same origin[1] is pretty much the governing rule here; there wasn't any point in making pushState any more secure than the rest of the system.

1) http://en.wikipedia.org/wiki/Same_origin_policy

Re:HTML5: Changing the browser-URL without refreshing page by Groxx on Thursday July 22, 2010 @02:07AM (#1537491)
It very well could. Consider that "real use cases" includes every website in existence. Some of the have utterly horrifying URL schemes.
Re:HTML5: Changing the browser-URL without refreshing page by wanderr on Thursday July 22, 2010 @05:11AM (#1537732)
It's not just horrifying URL schemes, it would make the feature useless for any "web app" - take Grooveshark for example. A user can go from /artist/x/1234 to /song/x/1234 which seems pretty reasonable and not very horrifying.
Re:HTML5: Changing the browser-URL without refreshing page by mseebach on Thursday July 22, 2010 @06:35AM (#1537816)
As long as the script-file lives at / there's no problem..
Re:HTML5: Changing the browser-URL without refreshing page by fortes on Thursday July 22, 2010 @05:07PM (#1539543)
I'm happy to see this is going to be implemented by the browsers of the future. I've started a project to port the API to older browsers:

http://github.com/fortes/history.js

Patches welcome!

Re:HTML5: Changing the browser-URL without refreshing page by korch on Wednesday July 21, 2010 @04:56PM (#1536526)
This is the greatest html5 feature I've never heard of, and it's really going to change how everybody make web apps.

Here's my wild prediction: 10 years from now, with the benefit of hindsight, we will trace the moment where Google's Page Rank empire started to crumble to the introduction of this html5 feature.

However, discovering this makes me wonder what other incredibly useful but as yet unknown html5 features are out there in the wild?

Re:HTML5: Changing the browser-URL without refreshing page by gojomo on Wednesday July 21, 2010 @05:41PM (#1536634)
How does this feature make much difference to Page Rank (or the many other ranking factors now as important or moreso for Google)?
Re:HTML5: Changing the browser-URL without refreshing page by korch on Friday July 23, 2010 @07:12PM (#1542663)
By decoupling urls in the browser from urls in the web app, it's only going to increase the amount of content in the Deep Web that Google can't index. I imagine it'll be difficult to make GoogleBot crawl and index "pages" after large swaths of the web are using this. And once this Javascript feature is in jQuery, then we can expect a huge number of web developers to start using it by default.

I don't know how much Javascript the GoogleBot currently parses and/or executes, but I imagine it would be enormously complex to embed v8 into the crawler, and then execute all Javascript on every page and determine what to index on a "page." If we ever get to the point where you can't screen scrape a web app without also executing its Javascript, then PageRank-like methods become less effective, and we'll need more semantic approaches to search. It's a great thing such semantic approaches don't yet exist!

Re:HTML5: Changing the browser-URL without refreshing page by gojomo on Friday July 23, 2010 @08:28PM (#1542784)
Some Google crawls already execute Javascript; they could easily do so more extensively if that were the only way to reach valuable content.

Also, Google is already promoting a convention for making the various parts of an AJAX application reachable via different URL-#fragments more easily crawlable. See:

http://www.google.com/support/webmasters/bin/answer.py?hl=en...

A number of sites including Facebook have adopted this convention; app developers usually want to be found by search engines.

Re:HTML5: Changing the browser-URL without refreshing page by korch on Saturday July 24, 2010 @07:01PM (#1544570)
Microsoft for one would love to have a big chunk of Internet real estate that couldn't be found and indexed by Google.

It's funny you mention Facebook. I would say Facebook's chief motive right now is to stop Google from encroaching upon their territory, so Facebook wants to put up as many speed-bumps as possible around Google. Basically that means keeping Google sandboxed—it's okay to let Google index anything they want and throw that up on an ordered SERP, but no way can we let them grow elaborate ivy APIs and web-based UIs around our walled-garden of user generated content. (i.e. Buzz.)

Given Microsoft's ownership and early partnering with Facebook, Microsoft and Facebook have aligned interests in keeping Google in the sandbox.

Re:HTML5: Changing the browser-URL without refreshing page by gorog on Thursday July 22, 2010 @09:01AM (#1537984)
It's exactly the feature I desperately wanted a few months ago, but then I modified the UI so that it loads a page for each piece of information that's important enough to have it's own URL and the result was considerably simpler to use. This feature will make it very easy to write overly complicated interfaces. Designers will have to be careful.