Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Script5: Access denied in IE9 when website is opened from gmail email link #457

Open
atellier opened this issue Jul 1, 2011 · 11 comments
Open

Comments

@atellier
Copy link

atellier commented Jul 1, 2011

To reproduce the problem:

  • Send an email to yourself on your gmail acount and include the follwing url (the demo page): http://blueimp.github.com/jQuery-File-Upload/
  • Fire up IE9 and click on the link above from within gmail. Now try to upload an image - progress bar will animate but no file gets uloaded (use the dev tool and monitor the Network - no file is sent out).

I have reproduced the issue on IE9 (but in IE8 and IE7 mode). If you open a new windows and go to the demo site, uploading works. It really breaks when the demo page is opened by clicking on the linking within gmail.

Thanks for the help - and thanx for this great tool!

@blueimp
Copy link
Owner

blueimp commented Jul 4, 2011

Thanks for the report. I currently don't have the resources to tackle this issue but I'm open for a user contributed fix.

@JDutil
Copy link

JDutil commented Jul 20, 2011

I can confirm this happens. A request to the server is actually made though, but it returns a url 1 character at a time for the json response...

I'm having an error of uploads not starting in IE9 with my sites implementation of the file uploader. Works fine on the demo site, and used to work on my site until we began to customize the html and extend methods etc... Not sure what we've done that causes the uploader to break, but possibly could be related if we can figure it out. Although it may not be since our issue is that IE9 won't even fire a request to the server once a file is selected (autoUpload is true).

@JDutil
Copy link

JDutil commented Jul 20, 2011

All I've been able to come up with is that for some reason in IE9 the following data.submit() doesn't do anything even though I've confirmed that the code is being triggered and data is set to being validated.

https://github.com/blueimp/jQuery-File-Upload/blob/master/jquery.fileupload-ui.js#L74

I've also tried modifying it to be data.form.submit() or data.form[0].submit() and that change will get fired by IE, but none of the form data is sent...

Edit: Actually it looks like the problem is that the form being serialized for the iframe transport is just returning an empty array, but wouldn't that still at least fire off a request to the server?

@JDutil
Copy link

JDutil commented Jul 21, 2011

I was able to resolve my issue of IE9 not firing the requests by ensuring that the file input was within ancestor elements containing the .fileupload-buttonbar & .fileinput-button classes. We were trying to implement our own buttons, and despite overwriting just about every method we could see referencing those classes for anything meaningful IE9 simply would not properly build the iframe / form without those classes.

@blueimp
Copy link
Owner

blueimp commented Oct 1, 2012

I've revisited this issue and could finally track it down to a browser bug:

IE9 (and possibly other IE versions) doesn't allow submitting a HTML form programmatically (neither via form.submit() nor via button.click()), if the containing document has been opened via a Gmail link.

Instead the browser will throw the following error in the developer console, indicating the line containing form.submit() or button.click():

SCRIPT5: Access is denied.

I've created a JSFiddle in pure JavaScript, without including the jQuery File Upload plugin or even jQuery, to demonstrate the problem:
http://jsfiddle.net/qdR2p/

To reproduce it, the following link to the JSFiddle result frame has to be followed via an email received via Gmail:
http://fiddle.jshell.net/qdR2p/show/

The demo code is very simple and included below:

<form method="POST" enctype="multipart/form-data" id="form">
    <input type="file" name="files[]" id="input">
</form><script>
var input = document.getElementById('input'),
    form = document.getElementById('form'),
    submit = function () {
        form.submit();
    };
if (input.addEventListener) {
    input.addEventListener('change', submit, false); 
} else if (input.attachEvent)  {
    input.attachEvent('change', submit);
}
</script>

As to why this only happens with links opened via Gmail, I couldn't find out yet.
If the link is simply copied to load the page into a new window, IE doesn't throw any script errors on programmatic form submit.

@iuri-gg
Copy link

iuri-gg commented Oct 2, 2012

Why is this issue closed? I just followed to demo page from gmail in IE9 and script access denied error is still there. Plugin does not work with IE9 on links from gmail.

@blueimp
Copy link
Owner

blueimp commented Oct 3, 2012

This issue has never been closed. You probably misinterpreted the closed badges of the referenced issues.

Anyway, this issue is unrelated to the plugin itself since it can be reproduced with the simple code snippet I posted in my comment above.

It's definitely a browser bug (or maybe a browser security feature) in IE9.
Unfortunately, Microsoft doesn't have any public bug tracker for Internet Explorer, else I would have filed a report.

@iuri-gg
Copy link

iuri-gg commented Oct 3, 2012

I see. Thanks

@jaso7605
Copy link

jaso7605 commented Nov 6, 2012

Not that this is much help, but I opened an MSDN case for this. They verified the problem exists in IE9 and doesn't exist in any other version (including 10). They provided a workaround (use IE8 compatibility on the Gmail page), but told me that because they provided a workaround, they wouldn't dig to find a root cause or a true fix unless I paid for "Premier Support".

@blueimp
Copy link
Owner

blueimp commented Nov 6, 2012

Thanks @Jaswolf.
At least this gives us the possibility to notify IE9 users to use IE8 compatibility mode on Gmail.
However it's still a little disappointing from Microsoft, since the workaround has to be applied by the users themselves.

@Russel22
Copy link

@blueimp:
this IE9 bug also affects pure html upload form (not programmatically).
This is a submit bug.

And the bug it also affects that browser window in other ways:

  • problems opening a bookmarked site (Favorites).
  • not possible to open a page by writing an url i browser address field and press enter.

Note:
it's only occurs after you left click e-mail links in gmail. If you right click and choose "Open" the bug does not appear.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants