Cross Browser Issue. Need advice

和自甴很熟 提交于 2019-12-25 05:12:13

问题


I designed an input upload box using jquery that i googled somewhere, problem is the "Browse" Button is not working(not clickable) on IE. Can anyone take a peek on the code and help me what i should do or tweak for this to work on IE? Thanks a lot. I've included the html/css/js files on jsfiddle bellow.

jSFiddle


回答1:


The "browse" button that you added doesn't work in IE 7/8/9, Chrome, or Firefox. You may have a different experience, which reinforces the point I'll try to make.

It's better to either use a Flash-based file upload to completely replace the default UI (I believe GMail still does this), or just leave the default input alone, ugly/inconsistent as it may be. There are many hacks to style file uploads, but no real solutions (at least that I've come across).

The closest thing I have found to a pure HTML/CSS solution was to overlay a styled button on top of the file input's "browse" button and hide the rest of it. I then mimicked async capabilities by placing the whole thing inside of an IFRAME. This solution did/does still work but I wasted hours tweaking it visually, added a bunch of extra code to hook the IFRAME to the containing page, and increased the complexity of the overall solution. And the next update to any browser may break it.

HTML 5 does offer much more flexibility around the file upload process (see here) but such solutions aren't universally supported yet and still don't necessarily address aesthetic concerns.

Drag and drop capabilities may be useful to you as you can hide the file input altogether. You may be able to use a solution like this in newer browsers and degrade to a standard file input on older browsers which do not support it.

Another example with progressive enhancement.



来源:https://stackoverflow.com/questions/10546074/cross-browser-issue-need-advice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!