Joint gravitational-wave and γ-ray bursts (GRB) observations are among the best prospects for standard siren cosmology. However, the strong selection effect for the coincident GRB detection, which is possible only for sources with small inclination angles, induces a systematic uncertainty that is currently not accounted for. We show that this severe source of bias can be removed by inferring the a-priori unknown electromagnetic detection probability directly from multimessenger data. This leads at the same time to an unbiased measurement of the Hubble constant, to constrain the properties of GRB emission, and to accurately measure the viewing angle of each source. Our inference scheme is applicable to real data already in the small-statistics regime, a scenario that might become reality in the near future. Additionally, we introduce a novel likelihood approximant for GW events which treats the dependence on distance and inclination as exact.