1

I want to send post request with files and some text fields via iframe transport.

(jquery-file-uload + jquery.iframe-transport)

The url of main page http: //192.168.1.36:3001/index.html. The request url is http: //192.168.1.36:3001/api/upload.

I've already read: 1 2 3 4 5 6 7

etc questions.

Additional information:

browser: ie 9.0.8112.16421

headers of /index.html: 

Cache-Control:no-cache
Cache-Control:public, must-revalidate, proxy-revalidate
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html
Date:Thu, 25 Sep 2014 19:34:41 GMT
Expires:Thu, 25 Sep 2014 19:34:40 GMT
Last-Modified:Thu, 25 Sep 2014 19:17:41 GMT
P3P:CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
Pragma:public
Server:nginx/1.6.2
Transfer-Encoding:chunked
Vary:Accept-Encoding

domain in iframe is 192.168.1.36, domain in main page is same (192.168.1.36)

But "SCRIPT5 Access denied" in "form[0].submit()". I replaced "form.submit()" to "form[0].submit()".

Also I tried to add to the form a special submit button and attempted to trigger('click'). Doesn't work.

Is it possible??

Thanks

Community
  • 1
  • 1
Alexey Sh.
  • 1,734
  • 2
  • 22
  • 34
  • you're trying to make some JS code in the parent page submit a form in the iframe sub-page? – Marc B Sep 25 '14 at 19:56
  • @MarcB I'm trying to send ajax request via iframe transport from main page. are you read and understood the question? – Alexey Sh. Sep 25 '14 at 20:00
  • **NOWHERE** in your question did you once mention "ajax", and there's no such thing as "iframe transport". – Marc B Sep 25 '14 at 20:01
  • @MarcB there is **one** way to send **post request** by using **jquery** - AJAX. So iframe transport is available as additional js script (just _google it_). Are you competent in this theme? – Alexey Sh. Sep 25 '14 at 20:10
  • possible duplicate of [SCRIPT5: Access is denied in IE9 on file upload](http://stackoverflow.com/questions/6138859/script5-access-is-denied-in-ie9-on-file-upload) – Paul Sweatte Oct 02 '14 at 00:11

1 Answers1

2

@John,

When you wrote:

Also I tried to add to the form a special submit button and attempted to trigger('click'). Doesn't work.

does that mean that you were trying to trigger the file browse using something other than the <input type="file"> element? E.g. Trying to style the browse button by hiding the file input element?

If so, the SCRIPT5 error is because IE9 thinks it's being secure trying to prevent an upload not initiated by the user.

Solution: If you style the file input element to be visibility: hidden; instead of display: none, and you use a label to initiate the action, it will work. You can style the label as you want and it will do almost everything you want it to (I couldn't get it to work with keyboard focus & Enter key).

e.g. The following worked for me:

<label class="my-label-button-style">
    <input type="file" class="my-ie9-hidden-file-input"/>
    Click me
</label>

and CSS:

.my-ie9-hidden-file-input {
    visibility: hidden;
    position: absolute;
    width: 1px;
    height: 1px;
}
Daryn
  • 4,791
  • 4
  • 39
  • 52