Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Google Chrome 4 now natively supports Greasemonkey user scripts (chromium.org)
116 points by sahaj on Feb 1, 2010 | hide | past | favorite | 50 comments


I've been a big firefox fan since phoenix, but already moved to chrome for only one reason:

Fastest...browser...evar


I don't get what it is that people are talking about wrt speed. I've done side by side visual tests loading JS heavy sites like gmail and google docs and I can barely tell the difference, sometimes firefox wins sometimes chrome, the main thing I'll notice is that the initial page layout flow are different, but they're basically both fast. The network is going to make the biggest impact on your browsing speed, not the browser. The only thing chrome buys me is having to learn some weird-to-me UI, and adding one more thing that I have to rely on Google for, no thanks.


Chrome is the first browser that got me excited since I switched from IE to Firefox back in the day (or rather, phoenix and then Firebird...).

Back in my Slackware days, I loved the rendering of Konqueror/KHTML, so when I got a Mac I started using Safari. I was good, but didn't really excite me. Just competent stuff..

But Chrome. Now that's pushing things forward! Firefox is so slow and bloated on the Mac, I only use it for Stumbleupon.


Likewise, on both points. It hasn't got the polish of Firefox, and the extension ecosystem is a little rough, and I miss the intelligent URL completion from the Awesomebar, but Chrome wins in speed and stability, and those were enough to move me away from Firefox for all but a few sites.

Speed is important.


Hasn't got what polish of Firefox? Firefox is buggy and has a kludgy UI. Chrome is way more polished.


Selecting multiple blocks of text. Scrolling with the mouse wheel. / for quick find (and ' for links).

edit: I wonder if this is similar to the difference between Windows and Mac. Windows might be inconsistent in the small things (e.g. button padding), but it gets the large things right. Mac gets the small things right but the large things horribly, horribly wrong. Chrome seems to get the small things right too (e.g. tab animations), but overall Firefox does much better.


Thanks, I didn't know about ' for links.


I also switched since version 4 beta, which I already considered to be better than firefox. Apart from the browser speed itself, what I also like is the innovation speed. Simple, Google is an expert in creating "internet software", and Mozilla is just not able to compete with them.


The best part about this announcement is that Google Chrome won't be treating user scripts as second-class extensions. Greasemonkey scripts will be treated like real extensions. The ease of creating Greasemonkey scripts plus the visibility of real extensions in the browser takes Google Chrome a huge step closer to Firefox.


I have a Greasemonkey script in FF (http://defcraft.blogspot.com/2009/02/greasemonkey-search-hel...) that'll google for the current selection in a background tab when ALT-G is pressed. And it uses GM_openInTab API call.

Its equivalent in Chrome seems to be chrome.tabs.create. But when I tried that, I get this error: "chrome.tabs is not supported in content scripts". It seems that these "content scripts" aren't as powerful as extensions (http://code.google.com/chrome/extensions/content_scripts.htm...). Am I missing something here?


Yes. Chrome has different ways of extending the browser.

One is content scripts - which don't have access to certain parts of the Chrome api like opening tabs.

However, each extension can have what they call a background page. This is just an html page which is loaded in the background and there can be exactly one for every extension.

So you should be able to have your content script communicate with the background page (there is a mechanism for this) and let the background page open the tab.

For this, you'll have to write a fully-fledged extension though. The greasemonkey scripts probably don't generate a background page when they get converted into an extension at install-time.


I realize that this doesn't exactly address the root cause of your issue, but if you right click on selected text in Chrome, one of the menu entries will be to google for it in another tab.


Is the Chromium UserScripts page[1] out of date? Or are these still issues?

  Chromium does not support @require, @resource, 
  unsafeWindow, GM_registerMenuCommand, GM_setValue, or 
  GM_getValue.
A lot of scripts that I come across use `unsafeWindow`, `GM_setValue` and `GM_getValue.` It seems to be updated (since the last time I looked at it), since I believe it used to say that @exclude was not implemented, and now I don't even see a mention of it on the page (though I don't think I've come across a script that used @exclude).

[1]: http://dev.chromium.org/developers/design-documents/user-scr...

[UPDATE] This should shine some light on the topic: http://www.greasespot.net/2009/11/greasemonkey-api-usage.htm...


None of my personal scripts (which all use @require or unsafeWindow) work on this. I've been meaning to convert them to Chrome extensions anyway, though.


A Chrome-modified script I'm looking at uses `localStorage.setItem(name, value)` and `localStorage.getItem(name)` to re-implement `GM_setValue` and `GM_getValue`. The author stores and recovers type info as the first character of the data.


Mostly up to date, but I freshened some things.


I only wish Chrome would add a second search box, like IE and FF do. I have never figured out how to get the keyword for another search engine (Wikipedia) to work satisfactorily in Chrome's combination url/search entry area.


Works for me. In preferences, manage search engines. All or most of the search engines you've used in the past should be there. Edit the keyword to the keyword of your choice (for Wikipedia I use "wp"). In the omni bar, type "wp", space, query, enter. Alternatively you can use a tab instead of a space and this makes it more obvious that you are searching.


OK, so I update my search preferences to make "wp" the Wikipedia key word. (I think, ok, maybe "w" was too short or something.)

Close the browser. Reopen. Check the options again. (Still there.) Type wp (so far so good, the Chrome hints drop-down looks like I'm going to hit Wikipedia) space, "San Francisco" (no quotes) ... and oops, the hints have changed to "Google Search" (as soon as I type the first character.


That's puzzling. Don't know if it will help, but for reference I'm running the dev channel build on OS X.


I'm running 4.0.249.78 (36714) on Win 7 64-bit right now (where I get a slightly different problem than I described), but my description is from the latest build on 32-bit Win 7.

Hey I realize most of you guys like the single omni-box, (I consider it a waste of real estate), but at least make the second FireFox/IE type search box optional. Let the user decide.


I have no problems making it optional, as long as many similar options don't add bloat over time. But to fix your problem you might want to run either the beta channel or dev channel builds.

Dev channel: http://www.google.com/chrome/eula.html?extra=devchannel Beta channel: http://www.google.com/chrome/eula.html?extra=betachannel


I wish all other browsers would drop the unnecessary secondary box when they could be doing the searching in the address bar like Chrome.


Yeah, within a week of starting to use Chrome I started trying to type search terms in Safari's URL field.

That feature could seriously be a deterrent for switching away from Chrome or Firefox.


In Chrome, you can also use domain specific searches: start typing the domain name, and when autocomplete matches the domain, press tab, and the location bar becomes a site-specific search. e.g:

    ul <tab> <search terms>
expands to ultimate-guitar.com to search for guitar tabs

    en <tab> <search terms>
expands to en.wikipedia.org to search wikipedia

It's great that it automatically picks up search boxes in websites. So this works on any website that you have searched in the past - you don't have to manually set it up.


I really do WANT to use Chrome, but there are so many Firefox extensions I just can't do without. One step closer though.


They'll never have Tree Style Tabs I imagine, so I'm stuck forever with Firefox for that extension.

Not that I mind Firefox, but Chrome gets to do a reboot and start again without carrying legacy support/etc with it.

Early versions of Firefox felt "lighter" than IE to me for that reason.


Remember when Firefox was the lightweight web browser? Of course it was called Phoenix back then, and later Firebird. It was refreshing.


Firefox was never a lightweight browser. It was fairly minimalist, especially compared with what came before it, but those things were just switched off or hidden, not removed, because that would have been a lot more work.

It's probably only got more "lightweight" with time as they've had more opportunity and funding to optimise and actually remove things they don't use.


Does Chrome support scrolling to where you were on the page when you hit the back button yet? That was what made me switch back to firefox.


It always has for me.


this is exactly what's going to make me switch from firefox to chromium


Does not anyone else get really let down every time they read a Chrome submission that doesn't announce that Firebug has been ported over?

I've started using Chrome for my day to day browsing, but I'll never be able to wholeheartedly switch until Firebug arrives.


Chrome comes with the element inspector built in which replicates a lot of the functionality of Firebug.


A lot, but not enough. In place editing of HTML, CSS and cookie manipulation are almost non-existent, especially compared to the way firebug allows it.


The element inspector is handy, but personally I would also need JavaScript step through debugging like Firebug provides.


Have you actually tried WebKit's developer tools lately?

It has a great DOM inspector (allows editing), network/script/rendering timeline, step-through debugger, profiler, cookie and local database inspector, and Chrome even has a heap analysis tool (see which objects are allocated).

It's far better than Firebug, at least for JavaScript developers, IMO.


Chrome has step through debugging. Check the 'Scripts' tab of the inspector


The element inspector comes somewhat close, but you can't add css attributes to selectors, only modify existing ones, which really makes the thing useless when doing front end dev


Are you sure? I think you can edit the text of stylesheets, and add new style properties on individual elements too.


Editing the text of stylesheets: no.

Editing style rules applied to elements: yes, you can do this. Select an element in the inspector, and you can click to edit its style rules.


unless you're seeing something I'm not seeing, you can only modify existing attributes. If you could show me though, an upvote will be in your future :-)


Though not as useful as firebug you are able to add a 'style="<custom css>"' attribute to an element by hovering over and clicking the '?=""' that appears.


I always thought Google had a browser for the masses in mind with Chrome. Something that is easy to use, stable and fast: a good alternative for IE.

User scripts are something for power users, who will always prefer Firefox. Won't this create the risk that average users will accept installing all kinds of scripts without much regard for security implications? User scripts are a powerful yet low-threshold tool which could easily lend itself to purposes such as identity theft.


I'm a power user, but I use Chrome. I only fire up Firefox when I want to do something on a page that requires a Firefox extension (like HttpFox or MAFF).

[edit] I would almost appreciate a Chrome/Chromium extension that adds a 'open this page in X browser' option so that I can open it in Firefox when I need to without needing to copy over the URL manually.


> power users, who will always prefer Firefox

Why do you say that? Chrome has extension support, I'm not sure what unique feature Firefox will have left shortly.


Chrome extensions are OK, but they're severely limited compared to what you can pull off with FF extensions: http://conkeror.org used to be implemented using only the FF extension mechanism. Chromium extensions cannot alter built-in UI elements, so you're stuck with the standard WIMP UI. It's the only thing keeping me on the Gecko platform.


Out of curiosity, would this prevent a chrome equivalent of the SQLite manager?


You're right, I totally missed that announcement. That pretty much invalidates my whole point, sorry.


Sane mouse wheel scrolling, by the looks of it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: