菜鸟教程小白 发表于 2022-12-11 18:12:05

javascript - Instagram 应用内浏览器裁剪的任何解决方法?


                                            <p><p>Instagram 发布了(在今年某个时候)他们的应用内浏览器 (webview) 的更新,至少在 iOS 中,它破坏了大多数网站。</p>

<p>所附图片是点击广告上的“了解更多”后打开的网站,但在个人资料生物链接上也有相同的行为。</p>

<p>问题?顶部栏似乎是网站上的叠加层,使大多数移动导航(左上角的汉堡图标)无法使用/无法点击和/或隐藏。</p>

<p><code>innerHeight</code> 与 <code>screen.height</code> 相同。正如 <a href="https://stackoverflow.com/questions/40926277/how-to-adjust-html-css-layout-for-instagram-in-app-browser/45697862" rel="noreferrer noopener nofollow">How to adjust html/css layout for instagram in-app browser?</a> 所回答的那样,我们可以嗅探 webview 的用户代理。</p>

<p> <a href="/image/t8JkW.jpg" rel="noreferrer noopener nofollow"><img src="/image/t8JkW.jpg" alt="SXSW website via Instagram Ads click"/></a> </p>

<p>不确定他们是否会在某个时候修复它,但似乎任何填充顶部类型的解决方案都会破坏。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我发现了一个替代方案,理论上不应该在他们发布适当的修复程序时中断(鉴于目前有大量广告指向损坏的网站:)</p>

<pre><code>if (window.innerHeight === window.screen.height &amp;&amp; navigator.userAgent.match(/instagram/i)) {
// here apply the fixes
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于javascript - Instagram 应用内浏览器裁剪的任何解决方法?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/44956480/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/44956480/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: javascript - Instagram 应用内浏览器裁剪的任何解决方法?