问题标签 [android-websettings]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - Android - 来自网站的视频播放器未在 WebView 中播放
嗨,我有一个网站,里面有一个视频播放器,我想在我的 android 应用程序中播放那个视频播放器。视频播放器在 androids 原生浏览器中播放效果很好,但是当我指示 WebView 与播放器一起访问同一个站点时,视频播放器不会显示,播放器周围的所有内容都会显示。如何让视频播放器在我的应用程序 webview 中播放?
android - 启动平板电脑时 Webview URL 重定向/更改
我在我的应用程序中使用 webview 并使用代码提供硬编码的 URL。一切都运行良好,但是当我在 10.1" 平板电脑上测试它时遇到了一件事情。我提供的 URL 在手机上运行良好,但在平板电脑上它会将自身重定向到 URL 的桌面版本。
知道如何防止这种情况发生。我正在使用这个网址:http ://search.yahoo.com/mobile/s?submit=oneSearch&.intl=us&.lang=en&.tsrc=yahoo&.sep=fp&x=0&y=0&p=bike
我在 URL 中特别提到了移动设备,但它仍在重定向。任何的想法..??
java - Jelly Bean 中的 Phonegap/Cordova 应用程序中断 - Access-Control-Allow-Origin 和 setAllowUniversalAccessFromFileURLs
一年多来,我一直在使用 Cordova(又名 Phonegap)为 Android 开发*,并试图让我的应用程序可以在 Jelly Bean 中运行,但我收到以下错误:
(以及任何后续 ajax 请求使用 localhost 或 file:// 的类似错误)只是为了测试,我授予对 Access-Control-Allow-Origin 部分中 config.xml 中所有内容的访问权限
在我的研究中,我发现该错误与 Google 对 Android Jelly Bean 所做的设置更改有关。这是我发现的:来自:https ://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=commitdiff;h=07439ff9
-- 这是来自 org.apache.cordova.CordovaWebView
-- 这也是来自 org.apache.cordova.CordovaWebView
很高兴科尔多瓦试图解决这个变化,但不幸的是这不起作用......
在此处和此处的这些 SO 线程中,我找到了一个常见的解决方案,只需按如下方式更改设置:
现在我收到以下警告:
这是我的 AndroidManifest.xml 中的 api
为什么要求我将 minSdkVersion 更改为 16 而不是遵循我的 targetSdkVersion 16?
想法?
注意:我目前正在使用 Cordova 2.0、Eclipse Indigo SR2(所有更新当前)、Android SDK(所有更新当前)、Windows 7 Home(所有更新当前)、Java 7 Update 7。
javascript - Android:在 webview 中加载 URL 之前注入 JavaScript
我正在开发一个应用程序,其中在应用程序的 web 视图中加载了一个 URL。通过 JavaScript,我切出了网页的页眉和页脚,并在 webview 中显示内容。我的问题是,切出网页的页眉和页脚需要一些时间,大约 1-2 秒,页眉可见并立即隐藏。我正在附加我的 WebViewClient 类:
在onLoadResource()
方法上我正在注入 JS。
任何人都对我面临的问题有所了解,请帮助我克服这个问题。
android - 在 webview 加载之前加载图像?
我正在开发网络应用程序,我正在使用网络视图直接从网站 url 加载它。在 android webview 中加载该 url 时,它的加载速度非常慢,加载时间接近 5 -7 秒,平均在显示白屏时。所以,我在想的是在加载 webview 的过程中,我想在屏幕上显示一个图像,5 秒后应用程序将加载。因此,通过在 webview 加载时平均显示 5 秒的任何图像,用户可以直接访问应用程序而不会面临任何时间延迟(例如出现白屏)。
我的代码是:
我尝试使用启动画面,但是在启动画面超时后,webview 正在加载。
那么,任何人都可以帮助我解决这个问题。在加载 webview 时加载图像。
android - WebView 在 Android 2.3.7 上不显示视频
我尝试在 Android WebView 中播放 dailymotion.com 视频。
在 Android 4.0.1 上,当我在清单文件中设置 android:hardwareAccelerated="true" 时,它运行良好。
当我在 Android 2.3.7 上使用它时,视频在第一帧冻结,我可以在 logcat 上看到以下错误:
当我在 Android 4.0.1 内置浏览器上播放时,视频会在浏览器中播放。当我在 Android 2.3.7 内置浏览器中播放时,视频似乎正在打开外部媒体播放器。
这是我正在使用的代码:
我认为解决方案的关键在于 WebChromeClient。如果我删除该行mVideoWebView.setWebChromeClient(new WebChromeClient());
,即使在 Android 4 上视频也不会播放,而且我看不到错误。
android - Android: Want to show layout on top when user scroll up and hide when scroll down in webview
I'm building an application in which I have loaded the webpage on webview. I have one layout which contains edittext in that. I want to hide the layout when user is scrolling down in the webview and show it again when user scrolls to the top. I have tried using onTouch
but it only takes the MotionEvent.ACTION_MOVE
and all that. Here what my code looks like:
As you can see here I'm using top.setVisibility(LinearLayout.GONE);
, but this is not solving my problem, it completely hides my layout.
Any idea how to overcome this problem.
android - WebView setAllowUniversalAccessFromFileURLs 在低于 Api(16) 的版本上
当我尝试在 WebView 中运行某些网页时,我收到“不安全的 JavaScript 尝试使用 URL 数据访问框架”错误。
我读到(在网络上的某个地方)我应该设置 --allow-file-access-from-files 开关。在 Android API16 及更高版本上,我有 setAllowUniversalAccessFromFileURLs 选项,但在较低版本上没有(我得到错误的地方)。
例如,有没有办法在 android2.3.3 上处理它?
android - How to play inline html 5 video on WebView
How I can play html5 video embedded in html page on web view. Please provide descriptive example. Thanks.
android - 如何在具有适合所有设备的屏幕的 Webview 中显示网页的某些部分
我想在 WebView 中显示网页。到此为止还好。
但我有网页(如下所示),我想要它的某些部分。我的意思是在所有设备的适合屏幕模式下应该只看到左上角。
自过去两三天以来,我一直在解决此问题。
我想要什么: 我想显示网页的左上角以显示在 Webview 中,无论策略可能是缩放或任何其他选项,但它应该适合所有设备的屏幕。
还有一件事我不能改变网页的源代码,因为它是固定的。 我必须通过代码本身进行管理。
我尝试过的: 我参考了 Stackoverflow 链接,但没有运气。
这是我的代码。:
我正在设备中显示完整的网页。
它在我的 LG 设备(分辨率为 480*800)中运行良好,但在大型设备或 Galaxy Tab2 等标签中,我得到的左上角图像非常小,屏幕的所有其他区域只是网页的背景。
下面是运行上述代码后 Galaxy Tab2 的屏幕截图。
请给你任何我缺乏的建议。提前致谢。