Home > Web Front-end > JS Tutorial > body text

How to solve the 403 problem when html and jquery/js reference external images

小云云
Release: 2018-02-03 13:03:45
Original
1784 people have browsed it

This article mainly shares with you how to solve the problem that html-jquery/js encounters the problem that it cannot be seen or 403 appears when referencing external images. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look, I hope it can help everyone.

The solution is as follows:

<script type="text/javascript">
 function showImg(url) {
   var frameid = 'frameimg' + Math.random();
   window.img = '<img id="img" style="width: 100%;height: auto" src=\&#39;&#39; + url + &#39;?&#39; + Math.random() + &#39;\&#39; /><script>window.onload = function() { parent.document.getElementById(\'' + frameid + '\').height = document.getElementById(\'img\').height+\'px\'; }<&#39; + &#39;/script>';
   document.write('<iframe id="&#39; + frameid + &#39;" src="javascript:parent.img;" frameBorder="0" scrolling="no" width="100%"></iframe>');
   }
</script>

<p>
 <script type="text/javascript">showImg("图片url");</script>
</p>
Copy after login

I have passed the test!

Related recommendations:

The path problem of referencing images in jsp pages_html/css_WEB-ITnose

The above is the detailed content of How to solve the 403 problem when html and jquery/js reference external images. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template