Hacker News new | ask | show | jobs
by kennywinker 5087 days ago
That sounds much better than just defaulting to chrome if available.

That said, this is a bit too much overhead for most developers to actually implement. For instance, you would also need to create a settings bundle, so users can reset this setting if they want.

What I'd really like to see is Apple enable this at a system level. FireFox for iOS would be nice to see, and we don't want developers to have to revisit this issue if/when it comes.

2 comments

What about Google building this into the Chrome app?

When you launch the app for the first time, it could ask "Do you want to open URLs in Chrome by default in Chrome-enabled apps?", and make it possible to change this in Chrome's settings menu.

This setting could then be stored in a UIPasteboard named something like com.google.chrome.default, and apps that want to implement the functionality suggested in the original post would just look in this pasteboard for the current setting.

Interesting. Are there other examples of this hack being used and not kiboshed by Apple?
According to Apple's documentation, "The UIPasteboard class enables an application to share data within the application or with another application using system-wide or application-specific pasteboards." http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/...

For a couple examples: OpenUDID and SecureUDID use UIPasteboard.

Fascinating! I had no idea UIPasteboard could do that.
It sounds like a lot of overhead, but it's really quite simple. Objective-C is a bit verbose for a Hacker News comment, so I put it up as a Github Gist: https://gist.github.com/3080870

As for making a Settings bundle, that's pretty easy too and you wouldn't have to do it unless you wanted an easy way to let someone change their preference later.

Besides all that, I think everyone agrees with you that Apple should make it possible to do it at a system level. The simplest way to do this in my opinion would be to allow users to remove pre-installed apps if there is an alternative on the device. For instance, if I have an app that responds to "http:// URLs, allow Safari to be removed.

I guess my point was, without a settings option to re-set this, it's an incomplete feature. It works for a very narrow scenario, but not for the vast diversity of scenarios that the real world will bring. For instance, your code has a fairly large bug... if the user sets chrome as the default, then at some later point they delete chrome, it won't open urls anymore.

I would definitely encourage you to polish up that gist into some kind of easily incorporated module (a category on UIApplication, perhaps?)... the more people who start doing this sort of thing, the more pressure there will be on Apple to enable this the "right" way.

Polishing it up as a category is a good idea; I might do that tomorrow. But yeah, the point of all this is that you can't set a default browser in iOS.
Along with that allow chrome to run its own game-not require it to use the underlying web rendering thing.