postMessage() in iframe fails, because `document.referrer` returns empty string in iOS - ionic V3

I’m having a problem where a vendor’s javascript is throwing an error because document.referrer returns an empty string as a parameter being sent to postMessage().

Ionic:

   Ionic CLI          : 5.4.16
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 11.0.0
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 21 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : 1.6.0

System:

   Android SDK Tools : 26.1.1 (/Users/vamshi/Library/Android/sdk)
   ios-deploy        : 1.11.4
   ios-sim           : ios-sim/9.0.0 darwin-x64 node-v14.18.1
   NodeJS            : v14.18.1 (/usr/local/bin/node)
   npm               : 6.14.15
   OS                : macOS Monterey
   Xcode             : Xcode 13.4 Build version 13F17a
1 Like