Angularjs 如何在框架内使用沙盒重定向创建iframe?
我目前有一个应用程序,其中包含一个带有沙盒的iframe,因此它会阻止该框架访问顶部导航,如下所示:Angularjs 如何在框架内使用沙盒重定向创建iframe?,angularjs,redirect,iframe,sandbox,Angularjs,Redirect,Iframe,Sandbox,我目前有一个应用程序,其中包含一个带有沙盒的iframe,因此它会阻止该框架访问顶部导航,如下所示: <iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-pointer-lock" class="iframe" ng-src="{{source_url}}"></iframe> source_url包含一个url“Y”,该url重定向到“X”,其中显示了我需要
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-pointer-lock" class="iframe" ng-src="{{source_url}}"></iframe>
source_url包含一个url“Y”,该url重定向到“X”,其中显示了我需要的内容。沙盒iframe阻止它将我的整个应用重定向到站点“X”。问题是,它还阻止了帧在其中重定向,并向我显示“Y”,我需要帧来显示站点“X”,有什么方法可以实现这一点吗?找到一种方法捕获重定向到“X”并更改iframe源url的尝试是否可行
提前非常感谢,大家好 这是很久以前的事了,所以我可能对此有些生疏,但最终我的解决方案是离开沙盒iframe(以防止框架进入顶部导航),但不使用ng if加载内容,然后提取url“X”我想在我的控制器上显示,最后使用give-source\uURL在需要时加载帧 如下所示: 在我的控制器上:
app.controller('myCtrl', function($scope, $routeParams, $http, $sce){
$scope.load_frame = false;
...
$scope.source_url = $sce.trustAsResourceUrl(url_found);
在我看来
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-pointer-lock" class="iframe" ng-if="load_frame" ng-src="{{source_url}}"></iframe>
因此,当我更改load_frame的值时,它将加载受信任的url。不是最好的,但那一刻是我能完成的修复。希望能帮助某人:)您找到解决方案了吗?