2

I have written below code in javascript:

javascript code:

var fs=null;

        function initFS() {
            window.requestFileSystem =window.requestFileSystem || window.webkitRequestFileSystem;
               window.requestFileSystem (window.TEMPORARY, 1024 * 1024, function (filesystem) {
                fs = filesystem;
            }, errorHandler);
        }

html code:

<input type="button"  id="button2" name="click" value="show" onclick="initFS();" />

but after clicking on show button in initFS function, after line window.requestFileSystem (window.TEMPORARY, 1024 * 1024, function (filesystem) {
it is showing error as "uncaught type error". Is there any mistake in my code?

1 Answer 1

0

You can not define errorHandler

var fs=null; 


        function initFS() {
            window.requestFileSystem =window.requestFileSystem || window.webkitRequestFileSystem;
               window.requestFileSystem(window.TEMPORARY, 1024 * 1024, function (filesystem) {
                fs = filesystem;
                console.log(fs);
            }, errorHandler);
        }
        function errorHandler(e) {
           console.log(e); // it show everything that you want 
          }
Sign up to request clarification or add additional context in comments.

4 Comments

@Shikha: can you tell what console print
Console prints "FileError is deprecated. Please use the 'name' or 'message' attributes of DOMError rather than 'code'
read this answer stackoverflow.com/questions/24930403/… may be it helps instead of FileError use name and message attributes
-I have done as per given link by you but still the type error is coming. Is any other solution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.