Reading the cordova documentation inappbrowser I can not find a way to hide the Location Toolbar (ALWAYS AND WHEN it has "location = yes") and just for Android, becouse we can use "toolbar=no" on IOs.
Why the need to have active "location = yes"? You can put "no" and it does not appear anymore.
As I comment in this thread, I need the activated option to be able to make use of the functions of ionic native IAB
Options i use:
location=yes,
EnableViewPortScale=yes,
hidenavigationbuttons=yes,
enableViewportScale=yes,
hideurlbar=yes,
zoom=no,
mediaPlaybackRequiresUserAction=yes,
As we can see in the image, the toolbar still appears at the top.
Any option that has been overlooked? Is it possible to remove it with CSS, if so, does it have any Class or ID to call, or should I touch it with pure code?
Is it possible to hide the website URL at top of the in-app browser? No this is not possible. It is controlled by the browser itself.
Introducing InAppBrowser.com, a simple tool to list the JavaScript commands executed by the iOS app rendering the page.
for ios to implement use this code if you are viewing the .html or .pdf file it hide the address bar call this function getFileExtension
from your code.
function getFileExtension(filename) {
var fileName = filename.split('.').pop();
if (fileName == 'pdf')
{
viewLinkpdf(filename)
}
else
{
viewLink(filename)
}
}
function viewLink(filepath) {
var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
var win = window.open( url, "_blank", "location=no" );
}
function viewLinkpdf(filepath) {
var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
window.open(encodeURI('https://docs.google.com/gview?embedded=true&url='+url), '_blank', 'location=no,EnableViewPortScale=yes');
}
similar like for android but very minor changes are there
function viewLinkpdf(filepath) {
var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
window.open(encodeURI('https://docs.google.com/gview?embedded=true&url='+url), '_blank', 'location=no,EnableViewPortScale=yes');
}
function getFileExtension(filename) {
var fileName = filename.split('.').pop();
if (fileName == 'pdf')
{
viewLinkpdf(filename)
}
else
{
viewLink(filename)
}
}
function viewLink(filepath) {
var url = (filepath.match('http')) ? filepath : 'http://' + filepath;
var options = {
location: 'no',
clearcache: 'yes',
toolbar: 'no'
};
$cordovaInAppBrowser.open(url, '_blank', options)
.then(function (event) {
// success
})
.catch(function (event) {
// error
});
}
i place both the code here might be its repeated catch it which you want. I hope this will help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With