This isn't really a good method since it needs to be changed router to
router.
Here are two slightly better alternatives:
You could hit an external website like
http://www.whatismyip.com/ which will
return the user's public IP address. The only problem with this method is
that the site may go down or be otherwise unaccessable. Note you can create
your own website that will simply return the IP without the need for parsing
and it might be more reliable; however, it can still go down.
The other alternative which works very well if your router supports it, is
to use a dynamic dns service like dyndns.org. If your router supports this
function you can sign up for a free account and have an address like
<hostname>.dyndns.org. The router will then automatically refresh the IP
every so often. Resolving this dns entry will be the IP of the router.
Allowing the user to simply input the dns address to resolve will pretty
much cover every case so the user could use any service they desired..
If anyone can think of any other more generic solutions please post them,
but for now these are the best methods I can come up with.