0

I'm attempting to access the barcode scanner plugin from within an ionic app within an iFrame within my main ionic app.

I'm doing this through trying to send a message to open the barcode scanner from within the iframe to the main app when a button is pressed and retuning the value scanned.

When using ionic run with my android device I get the message 'SecurityError: blocked a frame with origin **my server ip** from accessing a cross-origin frame.' this is because I call '$window.parent.angular.element($window.frameElement).scope()'

Any tips on getting around this? Could I use an ajax call instead to open the scanner plugin?

The cross origin blocked message is coming from ionic, I have to call $window.parent.angular.element($window.frameElement).scope() before I can use postMessage to set the scope, this is the point at which I get the error.

James2356
  • 41
  • 4
  • See [MDN Developer Reference - Same Origin Policy - How to Allow Cross-Origin Access](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#How_to_allow_cross-origin_access) – georgeawg Mar 10 '17 at 22:09
  • Possible duplicate of [SecurityError: Blocked a frame with origin from accessing a cross-origin frame](http://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame) – georgeawg Mar 10 '17 at 22:11

0 Answers0