8

I have a URL for youtube :

<iframe class="embed-responsive-item" ng-src="https://www.youtube.com/embed/s7gJ74ARN84" allowfullscreen=""></iframe>

If i use this in my local html file it plays well. But when i paste the same in a phonegap ios app html page and run that in ios simulator it shows below error just as i click the video:

Blocked a frame with origin "https://www.youtube.com" from accessing a frame with origin "file://".  

The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "file". Protocols must match.

Solution:

It was not working in simulator but working in mobile and that was my ultimate goal.

Manish Kumar
  • 10,214
  • 25
  • 77
  • 147

3 Answers3

0

@Manish, since you have already dealt with the CORS issue, the error your a getting says:

The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "file". Protocols must match.

Since it is not CORS, have you gotten rid of the iframe? If that works, perhaps what you need is a hidden <div>.

Jesse

Irvin Dominin
  • 30,819
  • 9
  • 77
  • 111
-1

@Manish,

it appears you have the CORS problem. You can can add to your config.xml <access origin="*"/>.

Jesse

  • 1
    this does not seem to help (at least in iOS 9.3, cordova 6.4.0, cordova-plugin-whitelist 1.3.0) – Peter Dec 09 '16 at 08:24
-3

Hey this just a very Small Problem

your link is this => "https://www.youtube.com/embed/s7gJ74ARN84"

But you just have to change it to

this link "//www.youtube.com/embed/s7gJ74ARN84"

Remember when you try to load secure content in your site just remove protocol from link

chiragchavda.ks
  • 532
  • 7
  • 25
  • 1
    tried this `` and got this error `Failed to load resource: The requested URL was not found on this server. file://www.youtube.com/embed/bAQq2mENhR4` – Manish Kumar May 22 '15 at 04:48
  • in jsfiddle even `` working fine – Manish Kumar May 22 '15 at 05:59
  • try this link it seem to be useful http://stackoverflow.com/questions/7585643/youtube-videos-on-iphone-phonegap-app + https://developers.google.com/youtube/iframe_api_reference – chiragchavda.ks May 22 '15 at 06:02
  • Problem was that in IOS simulator it was not running but in mobile its running and that is my ultimate target :) – Manish Kumar May 22 '15 at 07:08
  • Glad you worked it out...if you changed any settings please post the solution – chiragchavda.ks May 22 '15 at 08:56
  • 1
    Doesn't that occur because it automatically matches the protocol? So `//url.com` would be`file://url.com` if the original page is `file://index.html` – JVE999 Jun 09 '15 at 17:44