Atitit. & #160; IE8.0 & #160; display the local image preview solution & #160; img. src = the local image path is invalid,

Source: Internet
Author: User

Atitit. IE8.0: Display local image preview solution img. src = the local image path is invalid,

Atitit. IE8.0 display local image preview solution img. src = the local image path is invalid Solution

 

1. IE8.0 display local image img. src = the local image path is invalid solution 1

1.1. div to complete. Filter1

1.2. If it is a local html, it seems that the relative path is not enough. 2

1.3. URL. createObjectURL (ma sida) 2

1.4. Css background () 2

2. This is Data URI scheme. 2

3. -- code2

4. Refer to 2

 

 

1. IE8.0: Solution for displaying the local image img. src = the local image path is invalid

Category:. net development 1419 people read comments (0) collect reports

 

1.1. Div. Filter

 

IE8.0 the local image img. src = the local image path is invalid and can only be used by div. Filter

 

 

Upload the image to the server, and set the relative path returned by the Service in attr.
The browser does not seem to allow you to preview local files on your computer.

 

 

Js in ie6 and 7 browsers does not support using the setattribute () method to modify the value in src or the type attribute of input, because this will cause security questions.

 

Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com

Reprinted please indicate Source: http://www.cnblogs.com/attilax/

 

1.2. If it is a local html file, it seems that the relative path is not used.

 

 

Self-powered server path ?? Check whether base64 is missing

 

1.3. URL. createObjectURL (ma sida) 1.4. Css background () 2. This is Data URI scheme.


Data URI scheme is defined in RFC2397 to embed small Data into a webpage without loading it from an external file. For example, the string above is actually a small image. copy and paste these characters into the address bar of Firefox and go to it to see it, a 1x36 white-gray png image.

 

3. -- Code

Prj. atibrow. captxGui

 

Byte [] read4img = filex. read4img (destFile. getAbsolutePath ());

String base = Base64.encode (read4img, false );

Rzt = "data: image/jpeg; base64," + base;

 

String call = (String) mp. get ("$ callback ");

String js2 = call + "('" + rzt + "');";

Boolean rzt2effecef.atibrowserexampleinstance.exe cuteJsTxt (js2 );

4. Reference

 

Html img Src base64 Image Display

Atitit. javascript js File Upload preview .doc

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.