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!