html - 来自html字符串的iOS Swift 4图像未在WKWebView中加载
<p><p>我在从 WKWebView 中的 html 字符串加载图像时遇到问题。在 UIWebView 中也不起作用。</p>
<p>html 字符串来自 API,我必须按原样显示内容,我无法控制标签或内容。
图像嵌入如下例所示。</p>
<pre><code><h2>This is a heading</h2>
<a href="https://www.w3schools.com/w3css/img_lights.jpg" title="" class="colorbox" data-colorbox-gallery="gallery-paragraphs_item-7725-ZrzXIAds_FA" data-cbox-img-attrs=" &quot;&quot;}"></a>
<p>This is a paragraph</p>
<p>This is another paragraph</p>
</code></pre>
<p>我尝试更改 info.plist 以启用应用程序传输安全设置,没有更改。
那里的所有示例都在 html 文本中带有标签,但是正如您在此处看到的,我必须从链接标签中显示它们。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>在<code><a></code>里面添加<code><Img></code>标签,像这样,</p>
<pre><code><h2>This is a heading</h2>
<a href="https://www.w3schools.com/w3css/img_lights.jpg" title="" class="colorbox" data-colorbox-gallery="gallery-paragraphs_item-7725-ZrzXIAds_FA" data-cbox-img-attrs=" &quot;&quot;}"><img alt="ImageName" src="https://www.w3schools.com/w3css/img_lights.jpg"></a>
<p>This is a paragraph</p>
<p>This is another paragraph</p>
</code></pre></p>
<p style="font-size: 20px;">关于html - 来自html字符串的iOS Swift 4图像未在WKWebView中加载,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/49900368/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/49900368/
</a>
</p>
页:
[1]