简体   繁体   English

PhoneGap应用程序InAppBrower无法正常工作

[英]PhoneGap Application InAppBrower not working

I have been working on this for days and days now and I have lost all hopes and I need help. 我已经为此工作了好几天,几天了,我失去了所有希望,我需要帮助。 What I am trying to do is to Open a PDF file which I am grabbing from a dropbox account with JS. 我想做的是打开一个我从JS的保管箱帐户中获取的PDF文件。 Now when uploading my code using phone gap the PDF opens just fine with IOS devices. 现在,当使用手机间隙上传代码时,PDF可以在IOS设备上正常打开。 The issues that I am facing is that it does not open in a new tab or new window. 我面临的问题是它无法在新选项卡或新窗口中打开。 So I am trap in the same page and there is no way out. 因此,我陷入了同一个页面,没有出路。 I have read all the possible related questions and answered with no success. 我已经阅读了所有可能的相关问题,但均未获得成功。 Could you please guys give me some help. 麻烦大家给我一些帮助。 This is my JS code: 这是我的JS代码:

  if(FileExtension!='xls' && FileExtension!='xlsx') // this condition for the pdf documents { var DownloaLink = getDownloadLink(data.contents[i].path); output+='<li><a href="javascript:void(0);" onclick="window.open(\\'https://docs.google.com/viewerng/viewer?url='+DownloaLink.url+'\\', \\'_blank\\', \\'_system\\', \\'location=yes\\')">'+FileName+'</a></li>'; //output+='<li><a href="'+DownloaLink.url+'">'+FileName+'</a></li>'; } 

and this is my config.xml 这是我的config.xml

 <?xml version="1.0" encoding="UTF-8"?> <widget xmlns:gap="http://phonegap.com/ns/1.0" xmlns="http://www.w3.org/ns/widgets" version="1.0.0" id="com.phonegap.helloworld"> <name>Forensic</name> <description> Forensic Medical Mobile Application </description> <author href="http://phonegap.com" email="support@phonegap.com"> PhoneGap Team </author> <content src="index.html"/> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-inappbrowser" version="1.0.1-dev"> <preference name="phonegap-version" value="3.7.0" /> <preference name="permissions" value="none"/> <preference name="orientation" value="default"/> <preference name="target-device" value="universal"/> <preference name="fullscreen" value="true"/> <preference name="webviewbounce" value="true"/> <preference name="prerendered-icon" value="true"/> <preference name="stay-in-webview" value="false"/> <preference name="detect-data-types" value="true"/> <preference name="exit-on-suspend" value="false"/> <preference name="show-splash-screen-spinner" value="true"/> <preference name="auto-hide-splash-screen" value="true"/> <preference name="disable-cursor" value="false"/> <preference name="android-minSdkVersion" value="7"/> <preference name="android-installLocation" value="auto"/> <preference name="SplashScreen" value="screen"/> <preference name="SplashScreenDelay" value="3000"/> <preference name="StatusBarOverlaysWebView" value="false"/> <preference name="StatusBarBackgroundColor" value="#000000"/> <preference name="StatusBarStyle" value="lightcontent" /> <gap:plugin name="org.apache.cordova.camera"/> <gap:plugin name="org.apache.cordova.media-capture"/> <gap:plugin name="org.apache.cordova.console"/> <gap:plugin name="org.apache.cordova.contacts"/> <gap:plugin name="org.apache.cordova.device"/> <gap:plugin name="org.apache.cordova.device-motion"/> <gap:plugin name="org.apache.cordova.device-orientation"/> <gap:plugin name="org.apache.cordova.dialogs"/> <gap:plugin name="org.apache.cordova.file"/> <gap:plugin name="org.apache.cordova.file-transfer"/> <gap:plugin name="org.apache.cordova.geolocation"/> <gap:plugin name="org.apache.cordova.globalization"/> <gap:plugin name="org.apache.cordova.inappbrowser"/> <gap:plugin name="org.apache.cordova.splashscreen"/> <gap:plugin name="org.apache.cordova.vibration"/> <gap:plugin name="com.sharinglabs.cordova.plugin.cache" version="1.0.0" /> <gap:config-file platform="ios" parent="UIViewControllerBasedStatusBarAppearance" overwrite="true"> <false/> </gap:config-file> <gap:config-file platform="ios" parent="UIStatusBarHidden" overwrite="true"> <true/> </gap:config-file> <icon src="icon.png"/> <icon src="www/res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:qualifier="ldpi"/> <icon src="www/res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:qualifier="mdpi"/> <icon src="www/res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:qualifier="hdpi"/> <icon src="www/res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:qualifier="xhdpi"/> <icon src="www/res/icon/blackberry/icon-80.png" gap:platform="blackberry"/> <icon src="www/res/icon/blackberry/icon-80.png" gap:platform="blackberry" gap:state="hover"/> <icon src="www/res/icon/ios/icon-57.png" gap:platform="ios" width="57" height="57"/> <icon src="www/res/icon/ios/icon-72.png" gap:platform="ios" width="72" height="72"/> <icon src="www/res/icon/ios/icon-57-2x.png" gap:platform="ios" width="114" height="114"/> <icon src="www/res/icon/ios/icon-72-2x.png" gap:platform="ios" width="144" height="144"/> <icon src="www/res/icon/webos/icon-64.png" gap:platform="webos"/> <icon src="www/res/icon/windows-phone/icon-48.png" gap:platform="winphone"/> <icon src="www/res/icon/windows-phone/icon-173-tile.png" gap:platform="winphone" gap:role="background"/> <gap:splash src="www/res/screen/android/screen-ldpi-portrait.png" gap:platform="android" gap:qualifier="port-ldpi"/> <gap:splash src="www/res/screen/android/screen-mdpi-portrait.png" gap:platform="android" gap:qualifier="port-mdpi"/> <gap:splash src="www/res/screen/android/screen-hdpi-portrait.png" gap:platform="android" gap:qualifier="port-hdpi"/> <gap:splash src="www/res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:qualifier="port-xhdpi"/> <gap:splash src="www/res/screen/blackberry/screen-225.png" gap:platform="blackberry"/> <gap:splash src="www/res/screen/ios/screen-iphone-portrait.png" gap:platform="ios" width="320" height="480"/> <gap:splash src="www/res/screen/ios/screen-iphone-portrait-2x.png" gap:platform="ios" width="640" height="960"/> <gap:splash src="www/res/screen/ios/screen-iphone-portrait-568h-2x.png" gap:platform="ios" width="640" height="1136"/> <gap:splash src="www/res/screen/ios/screen-ipad-portrait.png" gap:platform="ios" width="768" height="1024"/> <gap:splash src="www/res/screen/ios/screen-ipad-landscape.png" gap:platform="ios" width="1024" height="768"/> <gap:splash src="www/res/screen/windows-phone/screen-portrait.jpg" gap:platform="winphone"/> <access origin="*"/> <platform name="android"> <js-module src="www/scripts/inappbrowser.js" name="inappbrowser"> <clobbers target="cordova.InAppBrowser.open" /> <clobbers target="window.open" /> </js-module> <feature name="InAppBrowser"><param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser"/></feature> <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/> <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/> <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/> <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/> <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/> <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/> <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/> <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/> <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/> <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/> <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/> <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/> <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/> <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/> <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/> <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/> <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> </platform> <!-- ios --> <platform name="ios"> <js-module src="www/scripts/inappbrowser.js" name="inappbrowser"> <clobbers target="cordova.InAppBrowser.open" /> <clobbers target="window.open" /> </js-module> <config-file target="config.xml" parent="/*"> <feature name="InAppBrowser"> <param name="ios-package" value="CDVInAppBrowser" /> </feature> </config-file> <header-file src="www/src/ios/CDVInAppBrowser.h" /> <source-file src="www/src/ios/CDVInAppBrowser.m" /> <framework src="CoreGraphics.framework" /> </platform> </widget> 

Thanks 谢谢

You can not display a pdf file in android using inAppBrowser. 您无法使用inAppBrowser在android中显示pdf文件。 PDF file will get downloaded to your device file system when you open the link in android browser. 当您在android浏览器中打开链接时,PDF文件将下载到您的设备文件系统中。 Try document handler plugin which is very is to integrate. 尝试非常集成的文档处理程序插件。 Document handler plugin 文档处理程序插件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM