我很想在webView上显示推特网站。 如何删除/解除/隐藏标题(“打开应用程序”消息)?
<header class="CoreLayout-header" role="banner"><div class=" AppHeader"><div class="OpenInAppBar u-cf" jsnamespace="OpenInAppBar"><div class="u-containerWithGutter"><a href="twitter://user?screen_name=nba" jsaction="click:openApp" class="OpenInAppBar-link u-textSmall u-inlineBlock">Open application</a><button class="OpenInAppBar-dismiss u-floatRight" aria-label="התעלם" jsaction="click:snooze" type="button"><span class="OpenInAppBar-dismissIcon u-alignMiddle Icon Icon--close" role="presentation"><img src="data:image/gif;base64,R0lGODlhFwAkAIAAAP///////yH5BAEKAAEALAAAAAAXACQAAAIbjI+py+0Po5y02ouz3rz7D4biSJbmiabqyjIFADs="><svg viewBox="0 0 46 72"><use fill="currentcolor" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/i/rw/svg/c25636093d431d0e28be32cd59239cf6/icon#icon-close"></use></svg></span></button></div></div><div class=" AppBar u-cf" data-scribe-component="top_bar" jsnamespace="AppBar"><div class="u-containerWithGutter"><h1 class="u-floatLeft"><a class="AppBar-item" aria-label="Twitter" href="/" jsaction="homeNav"><span class="AppBar-icon Icon Icon--twitter" role="presentation"><img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="><svg viewBox="0 0 72 72"><use fill="currentcolor" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/i/rw/svg/c25636093d431d0e28be32cd59239cf6/icon#icon-twitter"></use></svg></span></a></h1><div class="u-floatRight"><a class="AppBar-search AppBar-item" aria-label="חיפוש בטוויטר" href="/search" role="search" jsaction="search"><span class="AppBar-icon Icon Icon--search" role="presentation"><img src="data:image/gif;base64,R0lGODlhBwAJAIAAAP///////yH5BAEKAAEALAAAAAAHAAkAAAIHjI+py+1cAAA7"><svg viewBox="0 0 56 72"><use fill="currentcolor" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/i/rw/svg/c25636093d431d0e28be32cd59239cf6/icon#icon-search"></use></svg></span></a></div></div></div><div class=" SignUpBar"><div class="u-containerWithGutter"><div class="SignUpBar-content u-md-size3of4"><div class="Grid Grid--withGutter"><div class="Grid-cell u-size1of2"><a class="SignUpBar-button u-sizeFull Button Button--textBlue " href="/signup"><span class="Button-content">sign</span></a></div><div class="Grid-cell u-size1of2"><a class="SignUpBar-button u-sizeFull Button Button--default " href="/session/new"><span class="Button-content">Enter</span></a></div></div></div></div></div></div><div class="AppHeader-tracking"><img src="https://cert.twitter.com/robots.txt"><img src="https://twitter.com/robots.txt"></div></header>
我正在使用jsuop库,但不知道如何删除标题。
答案 0 :(得分:7)
您可以尝试在onPageFinished
的{{1}}事件中注入一些javascript代码,这会删除标题。像这样:
WebView
(代码未经测试)
答案 1 :(得分:0)
只需将style="display:none"
添加到您想隐藏的内容中即可。
<header class="CoreLayout-header" role="banner">
<div class=" AppHeader">
<div class="OpenInAppBar u-cf" jsnamespace="OpenInAppBar">
<div class="u-containerWithGutter">
<a style="display:none" href="twitter://user?screen_name=nba" jsaction="click:openApp" class="OpenInAppBar-link u-textSmall u-inlineBlock">Open application</a>
<button class="OpenInAppBar-dismiss u-floatRight" aria-label="התעלם" jsaction="click:snooze" type="button"><span class="OpenInAppBar-dismissIcon u-alignMiddle Icon Icon--close" role="presentation"><img src="data:image/gif;base64,R0lGODlhFwAkAIAAAP///////yH5BAEKAAEALAAAAAAXACQAAAIbjI+py+0Po5y02ouz3rz7D4biSJbmiabqyjIFADs="><svg viewBox="0 0 46 72"><use fill="currentcolor" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/i/rw/svg/c25636093d431d0e28be32cd59239cf6/icon#icon-close"></use></svg></span>
</button>
</div>
</div>
<div class=" AppBar u-cf" data-scribe-component="top_bar" jsnamespace="AppBar">
<div class="u-containerWithGutter">
<h1 class="u-floatLeft"><a class="AppBar-item" aria-label="Twitter" href="/" jsaction="homeNav"><span class="AppBar-icon Icon Icon--twitter" role="presentation"><img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="><svg viewBox="0 0 72 72"><use fill="currentcolor" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/i/rw/svg/c25636093d431d0e28be32cd59239cf6/icon#icon-twitter"></use></svg></span></a></h1>
<div class="u-floatRight">
<a class="AppBar-search AppBar-item" aria-label="חיפוש בטוויטר" href="/search" role="search" jsaction="search"><span class="AppBar-icon Icon Icon--search" role="presentation"><img src="data:image/gif;base64,R0lGODlhBwAJAIAAAP///////yH5BAEKAAEALAAAAAAHAAkAAAIHjI+py+1cAAA7"><svg viewBox="0 0 56 72"><use fill="currentcolor" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/i/rw/svg/c25636093d431d0e28be32cd59239cf6/icon#icon-search"></use></svg></span></a>
</div>
</div>
</div>
<div class=" SignUpBar">
<div class="u-containerWithGutter">
<div class="SignUpBar-content u-md-size3of4">
<div class="Grid Grid--withGutter">
<div class="Grid-cell u-size1of2">
<a class="SignUpBar-button u-sizeFull Button Button--textBlue " href="/signup"><span class="Button-content">sign</span></a>
</div>
<div class="Grid-cell u-size1of2">
<a class="SignUpBar-button u-sizeFull Button Button--default " href="/session/new"><span class="Button-content">Enter</span></a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="AppHeader-tracking">
<img src="https://cert.twitter.com/robots.txt">
<img src="https://twitter.com/robots.txt">
</div>
</header>
或者,或者完全从源中删除它。