Fix social share-trigerred JS error

This should fix the JS error introduced by the previous PR .