Although I would not recommend going to all this hassle just to send a user to a web tab (see eyescream's answer), if you really really absolutely had to do this, here's a completely server-side solution:
1) ON Package Installation, either from an Apex Install Handler or a Visualforce "Setup/Getting Started/Configuration" page, do a callout to the Web Services API for your org, performing a describeTabs
call. To do this, use WSDL2Apex with the Partner WSDL to generate some Stubs within your package Development org. Also you'll have to include Remote Sites within your package (obviously this is all non-ideal, but hey, it IS a solution... isn't eyescream's answer starting to sound attractive??)
2) Cache the result of this describeTabs
callout in a Custom Setting (as per Abhinav Gupta's suggestion), ideally just stripping out the most important information, putting it in a custom Apex class or a Map<String,Object>
, and then using JSON.serialize()
to convert to a String, and then striping that String across multiple Textarea fields in a Custom Setting (you can have up to 300 textarea fields) following this suggestion. Of course you could go the "easy route" if you don't need this Describe Tabs information ever again, and just store your Web Tab's tab Id in a single text field on your Custom Setting. Forgive me for over-architecting, it's my job :)
3) At run time, in your Visualforce Page's Apex controller, access the stored values in the Custom Setting by reassembling your String, deserializing it into an Object (or just getting the desired Web Tab's Id from a stored field in your Custom Setting if you went the easy route). Because this Tab is not going away from your Managed Package, the tab's Id will remain stable within a given customer's org. So it's fine to store and access it this way.