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的更多相关文章

  1. Android WebView 开发教程

    声明在先:必须在AndroidMainfest.xml 里面声明权限,否则在Java里面编写的所有WebView浏览网页的代码都无法正常使用 <uses-permission android:n ...

  2. Android WebView 开发详解(二)

    转载请注明出处  http://blog.csdn.net/typename/article/details/39495409 powered by miechal zhao   概览: Androi ...

  3. webview之如何设计一个优雅健壮的Android WebView?(下)(转)

    转载:https://iluhcm.com/2018/02/27/design-an-elegant-and-powerful-android-webview-part-two/ (这篇文章写得有点晚 ...

  4. Android WebView 详解

    相关API 相关类介绍 WebResourceRequest 添加于API21,封装了一个Web资源的请求信息,包含:请求地址,请求方法,请求头,是否主框架,是否用户点击,是否重定向 WebResou ...

  5. 如何设计一个优雅健壮的Android WebView?(下)

    转:如何设计一个优雅健壮的Android WebView?(下) 前言 在上文<如何设计一个优雅健壮的Android WebView?(上)>中,笔者分析了国内WebView的现状,以及在 ...

  6. Android WebView学习

    Android WebView学习 文章来源:小小懒羊羊个人知识管理库 权限: <uses-permission android:name="android.permission.IN ...

  7. WebView & iframe

    WebView & iframe https://developer.android.com/reference/android/webkit/WebView.html Web-based c ...

  8. Android WebView 302斗争之旅

    一.背景 越来越多的业务接入,项目内多多少少会出现几个H5页面,只是单纯的提供WebView容器接入H5页面根本满足不了需求,他们需要登录态,需要制定协议控制Native的导航栏,或者需要JsBrid ...

  9. Android WebView useragent

    今天介绍一下Android WebView UserAgent, User-Agent(简称UA)是HTTP请求头部用来标识客户端信息的字符串, 包括操作系统, 浏览器等信息.为了建立手机客户端的信息 ...

随机推荐

  1. 阿姆达尔定律 Amdahl's law

    Amdahl's law - Wikipedia https://en.wikipedia.org/wiki/Amdahl%27s_law 阿姆达尔定律(英语:Amdahl's law,Amdahl' ...

  2. Java面向对象(三)—— 继承

    标签: java 继承 抽象类 this super abstract 概述 多个类中存在相同的属性和行为的时候,将这些内容抽取到单独一个类中,那么多个类无需在定义这些属性和行为,只要继承那个类即可. ...

  3. from unittest import TestCase

    from unittest import TestCaseBigInteger/Big_Integer.py at master · YulitaGap/BigInteger https://gith ...

  4. Hive语法小释

    阅读本文你可以获取: 1.数据库的查询 2.hive表的基本操作(建表三种常用方式.删除表.修改表.加载数据.内外表转换.添加分区.复制数据) 3.SQL到HiveQL的的一些不同点 1.   基本操 ...

  5. 五种C语言非数值计算的常用经典排序算法

    摘要:排序是计算机的一种操作方法,其目的是将一组"无序"的记录序列调整为"有序"的记录序列,主要分为内部排序和外部排序. 排序 排序是计算机的一种操作方法,其目 ...

  6. svn 启动项目报错,项目被lock

    问题描述 问题解决 (一)Eclipse SVN 插件处理 (二)SVN 客户端处理 (三)删除lock文件 问题描述 在使用开发工具开发项目时(如Eclipse),在做项目的中途,有时候Eclips ...

  7. 动态代理+静态代理+cglib代理 详解

    代理定义:代理(Proxy):是一种设计模式,提供了对目标对象另外的访问方式;即通过代理对象访问目标对象.好处是:可以在目标对象实现的基础上,增强额外的功能操作,即扩展目标对象的功能. 动态代理+静态 ...

  8. LCA算法——倍增

    概况 LCA(Lowest Common Ancestors),即最近公共祖先,是指在有根树中,找出某两个结点u和v最近的公共祖先. 实现过程 预处理:通过dfs遍历,记录每个节点到根节点的距离dis ...

  9. A. Little Elephant and Interval

    The Little Elephant very much loves sums on intervals. This time he has a pair of integers l and r ( ...

  10. hdu2639 Bone Collector II

    Problem Description The title of this problem is familiar,isn't it?yeah,if you had took part in the ...