Fix PubNub in iframe with 3rd party cookies disabled

If PubNub is used in an iframe with 3rd party cookies disabled, it currently throws the following error:

`Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.`

To fix this, we wrap the access of the `localStorage` object in a try/catch and polyfill if necessary.