angular-file-upload icon indicating copy to clipboard operation
angular-file-upload copied to clipboard

fix: IE bug when we're uploading from an iframe

Open Nowadays opened this issue 4 years ago • 3 comments

When using IE and iframes, if we upload a file from the iframe the File object is contructed using the window.parent.File, so checking value instanceof File yields false since it's the equivalent of doing value.constructor === window.File which also yields false since window.parent.File !== window.File

Note: if we're not in an iframe window.parent === window -> true, so no futher checking is necessary

Nowadays avatar Jul 02 '20 13:07 Nowadays

I tested the scenario you said, the result is true,can you provide test cases image

ygj6 avatar Jul 03 '20 07:07 ygj6

Just rechecked, this is an even worse edge case :

We're actually using a modal which holds the input that uploads the files in an iframe.

The issue is when you have a modal opened from the iframe BUT bound to the parent DOM (this is a technique to avoid weird issue with modal in iframes).

The issue is only in IE, chrome yields true on value instanceof File in the same scenario.

Sorry for not mentionning the modal, I didn't even think about that at first.

Nowadays avatar Jul 03 '20 09:07 Nowadays

Just rechecked, this is an even worse edge case :

We're actually using a modal which holds the input that uploads the files in an iframe.

The issue is when you have a modal opened from the iframe BUT bound to the parent DOM (this is a technique to avoid weird issue with modal in iframes).

The issue is only in IE, chrome yields true on value instanceof File in the same scenario.

Sorry for not mentionning the modal, I didn't even think about that at first.

I uploaded a use case to demonstrate this problem: examples/issues/pr876 But the result is true.

The picture below is the page I visited using IE11 browser, the button in the page opened a modal,there is an iframe in the modal box, there is an uploads input in the iframe, the final result is true

If I misunderstood what you meant, help improve this use case,thx. image

ygj6 avatar Jul 04 '20 03:07 ygj6