I am working with iframe in my project just tried to open url inside my app through iframe , but its not working at my end , please have a look and provide your valuable suggestion.I will be very thank full to you .
Here is my controller code :-
app.controller('IframeCtrl', function($http, $scope, $ionicPopup, $state,
$ionicLoading, LocalStorage, $sce) {
$scope.customUrl = $sce.trustAsResourceUrl('http://www.magentomobileshop.com/demo/payu/index/payu?orderid='
+ LocalStorage.getData("orderid"));
window.checkIframeUrl = function(curentUrl) {
alert(curentUrl);
};
});
My iframe.hml :-
<ion-view view-title="PayU Money"> <ion-nav-bar
class="bar-positive" align-title="center"> </ion-nav-bar> <iframe
src="{{customUrl}}" src="http://www.google.com"
onLoad="checkIframeUrl(src);" scrolling="none" frameborder="0"
height="600px" width="100%"></iframe> <ion-content> </ion-content> </ion-view>
here is what i try now as :-
My conroller :-
function($http, $scope, $sce) {
var url="http://www.magentomobileshop.com/demo/payu/index/payu?orderid=100000030"
$http.get($sce.trustAsResourceUrl(url)).success(function(data) {
$scope.myData = data;
});
}
My new Html :-
<div><iframe
ng-src={{myData}} frameborder="0"
height="600px" width="100%"></iframe> </div>
</div>
Okay, i think this might be the issue that payU is a secured Url so this might not be getting open on iFrame but is there any way i can track url in window.open(), so that i can close the webview when i will be on that tracked Url.
Thanks
Ah wait. I didn't notice you are inflating that value as a query param. I don't think it could work in any way. You are just filling an address, and whitelisting a link, you are not getting the data.
You probably could use
I don't know if iframe is supported by angular logic. Anyways, instead of the doubled "src" attribute, write
Also, it would be nice to put a validity check on the
value.