Android Webview & iframe auto full screen
Android Webview & iframe auto full screen
android webview iframe 全屏适配
https://stackoverflow.com/questions/50101902/webview-and-iframe-video-full-screen-issue
react native & webview
https://facebook.github.io/react-native/docs/webview
https://github.com/react-native-community/react-native-webview
https://www.tutorialspoint.com/react_native/react_native_webview.htm
deviceHeight &deviceWidth
import React, {Component} from "react";
import {
StyleSheet,
Dimensions,
Text,
View,
WebView,
Button,
} from "react-native";
let {
height: deviceHeight,
width: deviceWidth
} = Dimensions.get("window");
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description NestedIframe
* @augments
* @example
*
*/
import React, {Component} from "react";
import {
StyleSheet,
Dimensions,
Text,
View,
WebView,
Button,
} from "react-native";
// new
// import { WebView } from "react-native-webview";
let {
height: deviceHeight,
width: deviceWidth
} = Dimensions.get("window");
class NestedIframe extends Component {
static navigationOptions = {
title: "Iframe Screen",
};
constructor(props) {
super(props);
this.state = {
// url: this.props.navigation.state.params.url,
info: "url 不可为空!",
};
this.HTMLGenerator = this.HTMLGenerator.bind(this);
}
HTMLGenerator(uri = ``) {
let html = ``;
html += `
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,viewport-fit=cover" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author" content="xgqfrms">
<meta name="generator" content="VS code">
<title>eapp & iframe</title>
<!-- CDN css -->
<link rel="stylesheet" href="https://cdn.xgqfrms.xyz/iframe/eapp/css/common.css" />
<link rel="stylesheet" href="https://cdn.xgqfrms.xyz/iframe/eapp/css/infoDetail.css" />
<link rel="stylesheet" href="https://cdn.xgqfrms.xyz/iframe/eapp/css/dialog.css" />
</head>
<body>
<div class="iframBox">
<iframe
id="iframes"
data-dom="iframe"
frameborder="0"
height="100%"
width="100%"
scrolling="yes"
src="${uri}"
></iframe>
</div>
</body>
</html>
`;
return html;
}
render() {
let {
navigate,
state: {
params: {
url,
},
},
} = this.props.navigation;
// let url = this.props.navigation.state.params.url;
let {
info,
} = this.state;
// let uri = url || "";
// console.log(`uri =`, uri);
// if (!uri) {
// uri = `https://cdn.xgqfrms.xyz`;
// }
// let html = this.HTMLGenerator(uri);
//
let uri = `https://i6lncuflx.lightyy.com/index.html#/index/home`;
return (
<View style={styles.container}>
{
!uri
?
<View>
<Text
style={{
color: "red",
fontSize: 18,
textAlign: "center",
marginTop: 50,
}}>
{/* {info} */}
</Text>
<Button
title="返回主页"
onPress={
() => navigate(
"Home",
{
name: "xgqfrms",
}
)
}
/>
</View>
:
<Text
style={{
color: "#0f0",
fontSize: 12,
textAlign: "center",
marginTop: 10,
}}>
{uri}
</Text>
}
<WebView
bounces={false}
scalesPageToFit={true}
source={{
html: `
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,viewport-fit=cover" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author" content="xgqfrms">
<meta name="generator" content="VS code">
<title>eapp & iframe</title>
<style>
//
</style>
</head>
<body>
<div class="iframBox">
<iframe
id="iframes"
data-dom="iframe"
frameborder="0"
height="560px"
width="400px"
scrolling="yes"
src="${uri}"
></iframe>
</div>
</body>
</html>
`,
// `
// <iframe
// name="iframeWindow"
// src="${uri}"
// width="100%"
// height="100%"
// data-dom="iframe"
// target="_self"
// about:blank
// style="border: 0px solid red;"
// >
// </iframe>
// `,
}}
style={{
width: deviceWidth,
height: deviceHeight,
}}>
</WebView>
</View>
);
}
}
// css-in-js
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 0,
marginTop: 0,
}
});
export default NestedIframe;
export {
NestedIframe,
};
WebView & iframe 自适应 全屏
https://www.cnblogs.com/renhui/p/5900295.html
https://hacpai.com/article/1519975549750
https://zhuanlan.zhihu.com/p/24990222
https://www.cnblogs.com/baihuaxiu/p/6654496.html
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
Android Webview & iframe auto full screen的更多相关文章
- Android WebView 开发教程
声明在先:必须在AndroidMainfest.xml 里面声明权限,否则在Java里面编写的所有WebView浏览网页的代码都无法正常使用 <uses-permission android:n ...
- Android WebView 开发详解(二)
转载请注明出处 http://blog.csdn.net/typename/article/details/39495409 powered by miechal zhao 概览: Androi ...
- webview之如何设计一个优雅健壮的Android WebView?(下)(转)
转载:https://iluhcm.com/2018/02/27/design-an-elegant-and-powerful-android-webview-part-two/ (这篇文章写得有点晚 ...
- Android WebView 详解
相关API 相关类介绍 WebResourceRequest 添加于API21,封装了一个Web资源的请求信息,包含:请求地址,请求方法,请求头,是否主框架,是否用户点击,是否重定向 WebResou ...
- 如何设计一个优雅健壮的Android WebView?(下)
转:如何设计一个优雅健壮的Android WebView?(下) 前言 在上文<如何设计一个优雅健壮的Android WebView?(上)>中,笔者分析了国内WebView的现状,以及在 ...
- Android WebView学习
Android WebView学习 文章来源:小小懒羊羊个人知识管理库 权限: <uses-permission android:name="android.permission.IN ...
- WebView & iframe
WebView & iframe https://developer.android.com/reference/android/webkit/WebView.html Web-based c ...
- Android WebView 302斗争之旅
一.背景 越来越多的业务接入,项目内多多少少会出现几个H5页面,只是单纯的提供WebView容器接入H5页面根本满足不了需求,他们需要登录态,需要制定协议控制Native的导航栏,或者需要JsBrid ...
- Android WebView useragent
今天介绍一下Android WebView UserAgent, User-Agent(简称UA)是HTTP请求头部用来标识客户端信息的字符串, 包括操作系统, 浏览器等信息.为了建立手机客户端的信息 ...
随机推荐
- # Set the asyncio reactor's event loop as global # TODO: Should we instead pass the global one into the reactor?
daphne/server.py at master · django/daphne https://github.com/django/daphne/blob/master/daphne/serve ...
- kettle 连接oracle12c问题解决办法:
在oracle的安装文件目录......\NETWORK\ADMIN\sqlnet.ora 文件中添加该语句:SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8window ...
- openrstry 限流 是否有清零逻辑 连接池
openrstry 限流 是否有清零逻辑 https://github.com/openresty/lua-resty-limit-traffic # encoding=utf-8 # Shawn ...
- Docker系列(一)Docker概述,核心概念讲解,安装部署
部分内容参考链接: Docker实战总结(非常全面,建议收藏) 一. Docker概述 Docker是一个开源的应用容器引擎(基于Go语言开发),让开发者可以打包他们的应用以及依赖包到一个可移植的容器 ...
- Prometheus+Grafana+kafka_exporter监控kafka
Prometheus+Grafana+kafka_exporter搭建监控系统监控kafka 一.Prometheus+Grafana+kafka_exporter搭建监控系统监控kafka 1.1K ...
- centos 7_本地源制作
1.安装工具 yum install yum-utils createrepo yum-plugin-priorities 2.自己创建一个阿里源 vim /etc/yum.repos.d/ope ...
- DFS——求图的连通性问题
DFS作为一个竞赛必学的一个知识点,怎么说我都得写一下 遍历就相当于爆搜,只不过是搜的方式比较规整罢了. 深度优先遍历:为了避免重复访问某个顶点,可以设一个标志数组vis[i],未访问时值为0,访问一 ...
- 【uva 753】A Plug for UNIX(图论--网络流最大流 Dinic)
题意:有N个插头,M个设备和K种转换器.要求插的设备尽量多,问最少剩几个不匹配的设备. 解法:给读入的各种插头编个号,源点到设备.设备通过转换器到插头.插头到汇点各自建一条容量为1的边.跑一次最大流就 ...
- hdu1394Minimum Inversion Number
Problem Description The inversion number of a given number sequence a1, a2, ..., an is the number of ...
- 关于贪心算法的经典问题(算法效率 or 动态规划)
如题,贪心算法隶属于提高算法效率的方法,也常与动态规划的思路相挂钩或一同出现.下面介绍几个经典贪心问题.(参考自刘汝佳著<算法竞赛入门经典>).P.S.下文皆是我一个字一个字敲出来的,绝对 ...