Only thing is users must disable popup blocking for HN, in the unlikely case that you want to open more than 2 links at once, or open links when the user doesn't click something (like onload).
Only thing is users must disable popup blocking for HN, in the unlikely case that you want to open more than 2 links at once, or open links when the user doesn't click something (like onload).
Forgive me for hijacking this thread into technical support territory, but I've found documentation on this stuff hard to come by.
You'd have to synchronize things yourself to prevent tripping over yourself. Ditto for firing off functions in response to events (i.e. Poll loop and fire handler).
Save objects to local storage:
localStorage.name = "dang";
alert(localStorage.name);
You save stuff to localstorage in one tab, and in other tab you listen to "storage" event:
window.addEventListener('storage', function() {..})
[0] https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage...[1] https://developer.mozilla.org/en-US/docs/Web/Events/storage
Another option is shared web workers, though I never used it.
[2] http://stackoverflow.com/questions/12107424/communication-be...
[3] https://developer.mozilla.org/en-US/docs/Web/API/SharedWorke...
I confused things in my other comment (I deleted it)
Edit:
Yep
w2 = window.open('/');
w2.document.click()
Is fine if complying with the sameOrigin policyhttps://developer.mozilla.org/en-US/docs/Web/API/Window/open
It's OK, I'm sure the mods will take care of it.
EDIT: I know this isn't reddit but I couldn't resist. Dan it's admirable how nice and down-to-earth you are in spite of all the stuff you see here everyday...huge thanks for all your work in making HN what it is.
It's all done by keyboard shortcuts, which means the mapping to keys is pretty complicated and not as consistent as I'd like.
Edit: It's also written in a Lisp we made that only three of you have ever heard of :)
And you can compile that Lisp to JavaScript to build the Chrome extension?
Dan and Scott, though, and in this case mostly Scott.
It's very easy to check for localStorage support (some people disable it just like cookies) and it works, I think, everywhere except Opera, in almost every mainstream version.
(I use it a bunch).
https://developer.mozilla.org/en-US/docs/Web/API/Window/clos...
Thanks everyone for all the help!
I haven't tested, but you might be able to kind of fake it by having the tab immediately before the one you want to open do the opening. That wouldn't work for tabs that have opened external sites (the stories themselves), but you could at least send a message to one of the other HN tabs telling it to open your new tab, which should give you some control.
While I'm at it, is there a way to give a regular web app the kind of permissions that a Chrome extension manifest can give? It isn't just tab mechanics I need, but clipboard access and cross-domain privileges. Obviously this would still require client consent (and might still be Chrome-only) but it would be easier than an extension with all its deployment headaches.
Regarding cross-domain, what do you want to do exactly? In general there's no built-in support at least in Firefox to override default same-origin policy, but there are Chrome/Firefox extensions that for instance inject CORS headers to each response.
Edit: In Chrome, it seems you can disable same-origin policy with command line flag [2]