Unless my memory fails me, I think I have written the code to get the hosting OS from PhantomJS. You should use that here.