angular.js - [angular] After embedding an Iframe with an anchor, the Iframe does not display normally when loading the page for the first time.
PHP中文网
PHP中文网 2017-05-15 17:03:35
0
1
844

There is an angular project that needs to embed an iframe and link to another subdomain name. This address is anchored, and the url is as follows:

http://example.com/index.html?uk=tester#/zone

The code is as follows:
Html:

<iframe id="user" ng-src="{{myurl}}"></iframe>

JS:

angular.module('myapp').controller('DemoCtrl', function ($scope, $sce, $cookies, $http) {
    ...
    var url = "http://example.com" + "?uk=" + $cookies.get("uk") + "#/zone";
    $scope.myurl= $sce.trustAsResourceUrl(url);
});

The strange thing is that when this page is loaded for the first time, the iframe is displayed as blank (there is no problem with the iframe src). After refreshing it again, it can be displayed normally.

If the iframe src is an address without an anchor, such as embedding www.baidu.com, there will be no problem when loading the page for the first time.

So, the problem should be here at the anchor point "#/zone".

Does anyone know why? How to solve this problem! Thank you very much!

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
我想大声告诉你

Have the original poster solved the problem, please ask

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template