我有一个使用 WebView 的React Native应用。组件的render
代码可在下面找到。
可以轻松访问各种网站的各种URL。但是,访问https://www.businessinsider.com
中的URL并单击“后退”以关闭 WebView 时,应用程序崩溃(显示“应用程序已停止”弹出窗口,没有红屏,没有信息在调试器控制台中)。
请注意,当为URL打开WebView时,不会发生崩溃,而是通过单击“后退”按钮将其关闭。
致命异常:java.lang.IllegalArgumentException:意外的字符 Cookie值为830时为0x5e0:bipm = 1; bipmfb = 1; _ga = GA1.2.730317633.1533734898; __adblocker = false; landingPageCookie = https://www.businessinsider.com/stock-market-news-today-august-1-2018; um = 1; traffic_src = {“ ga_gclid”:“”; “ ga_source”:“(直接)” =; “ ga_medium”:“(无)” =; “ ga_campaign”:“” =; “ ga_content”:“” =; “ ga_keyword”:“” =; “ ga_landing_page”:“ https://www.businessinsider.com/tsa-watches-us-flyers-through-quiet-skies-air-marshal-program-2018-7” =; “ ga_client_id”:“ 730317633.1533734898”} =; __pnahc = 0; lux_uid = 153413757816453245; _gid = GA1.2.513121262.1534137579; _dc_gtm_UA-2241657-6 = 1; piano_limit = 1; _gat_UA-2241657-6 = 1; AWSALB = + TwrOFnQ + shc7A1U7raZPzlrMdf3mBs4K ++ lXLMKLcBMPWhoiVhmon6DPg9fB + 8WuQUMsNJTQw4Z3oLtyBkEiQwK + iK652RQ4Gze5P7oeCvt7Qb user_geo_location = {“ continentCode”:“ AS”; “ countryCode”:“ IL” =; “ country”:“以色列” =; “ region”:“ M” =; “ city”:“נתניה”} =; __tbc =%7Bjbd%7DeyJ2IjozLCJwayI6ImVpcnRHWjJLYnF6NmhwcDdHOE9lV1kxR3NiMjlkZ1VWcmZkdWZMMUpDZDlXZW1tS3BQaEVyM2NSUZZSV9InI; __pat = -14400000; __pvi =%7B%22id%22%3A%22v-2018-08-13-08-19-47-757-k8Apcr23DzhHzQkB-e834828d6286bb69c896ab5d24ecf755%22%2C%22domain%22%3A%22.businessinsider.com%22%2C %22time%22%3A1534137588759%7D; xbc =%7Bjbd%7DeyJ2IjozLCJwayI6ImVpcnRHWjJLYnF6NmhwcDdHOE9lV1kxR3NiMjlkZ1VWcmZkdWZMMUpDZDlXZW1tS3BQaEVyM2daSUZ5SiILN bipf = 1 在okhttp3.Headers $ Builder.checkNameAndValue(Headers.java:320) 在okhttp3.Headers $ Builder.set(Headers.java:300) 在okhttp3.Request $ Builder.header(Request.java:164)
render () {
const articleUrl = this.props.articlePostUrl
return (
<View style={styles.container}>
<View style={styles.topbar}>
<TouchableHighlight onPress={this.props.closeWebView}>
<Ionicons style={{ marginLeft: 16 }} name="md-arrow-back" size={24} color='black' />
</TouchableHighlight>
</View>
<WebView
ref={(ref) => { this.webview = ref }}
source={{ uri: articleUrl }}
thirdPartyCookiesEnabled={false}
onNavigationStateChange={(event) => {
if (event.url !== articleUrl) {
this.webview.stopLoading()
Linking.openURL(event.url)
}
}}
style={{ flex: 1 }}
/>
</View>
)
}