- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to choose between `window.URL.createObjectURL()` and `window.webkitURL.createObjectURL()` based on browser?
To choose, you need to define a wrapper function −
function display ( file ) { if ( window.webkitURL ) { return window.webkitURL.createObjectURL( file ); } else if ( window.URL && window.URL.createObjectURL ) { return window.URL.display( file ); } else { return null; } }
After that set it for cross-browser −
var url = display( file );
Advertisements