Link to home
Start Free TrialLog in
Avatar of Developer D
Developer D

asked on

iframe not working in IE11

I am using iFrame in my application's html, with ng-src="https://someOtherServer.co,/portal?token=theTokenID&language=en&embedded=true"
This iframe is not loading on IE bubt works in Chrome.

I have already tried adding:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
New Jquery library
but getting nowhere.

ANy help appreciated.

Thanks
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/>

should do the job.   Also it is a known issue with certain version of IE11. To isolate the issue, try to run IE11 in compatibility mode.

look at the MSFT Link for more details

https://support.microsoft.com/en-us/help/17472/windows-internet-explorer-11-fix-site-display-problems-compatibility-view
Avatar of Developer D
Developer D

ASKER

I have already tried: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> as mentioned in the description, didnt work for me.
ng-src - is this an Angular application?
Tried the compatibility mode, unfortunately that didn't fix anything either
It is Angular application
Why are you using ng-src with a hardcoded URL - why not just use src?
I put a sample together using an <iframe> with ng-src - seems to work fine across all browsers.

Are you not running foul of a mixed protocol issue. In otherwords the host page is on http: but the iframed page is on https and does not have a valid certificate? Can you browse to the https page in IE.
1. I am not using hardcoded ng-src, it is proper angular code ....scope.iFrameSrc = trustedResourceUrl;.... above code was an illustration
2. no http-https issue there, confirmed! I can browse to the given https page in IE, just not via the iFrame.
"I put a sample together using an <iframe> with ng-src - seems to work fine across all browsers." : is it something you can share please?
I can share but host does not have SSL cert so page does not load an https link - link is http://www.marcorpsa.com/ee/t2404.html
Have you tried this
Using Controller As
<div ng-controller="mainCtrl as ctrl">
  <iframe ng-src="{{ctrl.src}}"></iframe>
</div>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular-sanitize.js"></script>
<script>
(function() {
  'use strict';
  angular.module('app',['ngSanitize'])
    .controller('mainCtrl', mainController);

  function mainController($sce)
  {
    var ctrl = this;
	
    ctrl.src = $sce.trustAsResourceUrl("https://someOtherServer.co,/portal?token=theTokenID&language=en&embedded=true");
  }
})();
</script>

Open in new window


Using $scope
<div ng-controller="mainCtrl">
  <iframe ng-src="{{src}}"></iframe>
</div>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular-sanitize.js"></script>
<script>
(function() {
  'use strict';
  angular.module('app',['ngSanitize'])
    .controller('mainCtrl', mainController);

  function mainController($scope, $sce)
  {
    $scope.src = $sce.trustAsResourceUrl("https://someOtherServer.co,/portal?token=theTokenID&language=en&embedded=true");
  }
})();
</script>

Open in new window


Note the inclusion of the ngSanitize module and the injection of the $sce (Strict Contextual Escaping) service into the controller.
My code is exactly the "Using $Scope" code
Including this bit

$sce.trustAsResourceUrl

Open in new window


As you can see the code works on the sample I provided - the only difference is I am not using HTTPS on the sample link. I am using it locally - same result.

You have checked your console for errors?
Otherwise post your code so we can see what is going on.
1. Yes Including: $sce.trustAsResourceUrl bit
2. posting code will be an issue
3. IE console shows: Acess is denied, at browser.js(47182, 8)
that bit of broswer code:
// Object.getOwnPropertyNames is the only way to enumerate non-enumerable
// properties, so if we wrap it to ignore our secret keys, there should be
// no way (except guessing) to access those properties.
var originalGetOPNs = Object.getOwnPropertyNames;
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
  for (var names = originalGetOPNs(object), // line no. 47182
           src = 0,
           dst = 0,
           len = names.length;
       src < len;
       ++src) {
    if (!hasOwn.call(uniqueKeys, names[src])) {
      if (src > dst) {
        names[dst] = names[src];
      }
      ++dst;
    }
  }
  names.length = dst;
  return names;
};
Without source or a link it is difficult to diagnose. There is nothing wrong with using the ng-src as you have it - as demonstrated in the sample code - the problem must be elsewhere.

We can guess but without being able to see the issue not sure how to debug it - this seems to be something related to another part of your code.

What you can do is isolate it and then gradually add code back.

Start with a basic implementation - similar to my code above.

Get that working then gradually add the various other bits of code from your "broken" page until something breaks - that should give you an idea where the problem is.
I suspect:
- https://someOtherServer.co....that I am calling in my code has set the X-Frame-Options: https://myApp.com/* but my app url is https://extended.myApp.com/*. I will have X-Frame-Options changed to  https://extended.myApp.com/* and see.
Inspired by : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.