Here [developer.irt.org] is a good snippet with browser sniffing.
It uses a text link to popup the set homepage dialog. I would recommend this method over calling the dialog yourself. (As stated at the bottom of the code, it is annoying to users.) You can make a simple popup and put this link on it.