Webview in ionic 1


#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


#2

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.


#3

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


#4

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


#5

It is as it is…nothing changed in it


#6

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


#7

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


#8

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


#9

I solved it
This is solution :

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