Webview in ionic 1


When i use following code that time link is opening in device’s browser
but I don’t want like that

window.open($scope.url, ‘_blank’, ‘location=yes’);

I want o/p like webview means I want link will be open in page of my app


Hi @shivani8710

you should use extra params to hide toolbar,url panel so it should look like its open in popup type view.
for that you see this example

var opts = {toolbar: 'no',location: 'no',useWideViewPort: 'no',enableViewportScale: 'yes'};
window.open($scope.url, '_blank', opts);

this will open url in inappbrowser but will not look like browser.


It is not working…Missing something…but what i don’t know


have you tried built app and checked this in android device.


It is as it is…nothing changed in it


Don’t you actually have to install the inappbrowser plugin for that to work?
(inappbrowser “hijacks” window.open when it is installed)


I added plugin

cordova plugin add cordova-plugin-inappbrowser

after that I apply this code
var opts = { toolbar: ‘no’, location: ‘no’, useWideViewPort: ‘no’, enableViewportScale: ‘yes’ };
window.open($scope.url, ‘_self’, opts);

but it is open in browser and I dont’t want it


Read the docs: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/


I solved it
This is solution :

$scope.myLink = $sce.trustAsResourceUrl($scope.url);