简体   繁体   中英

IE9 SCRIPT5 Access denied

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

@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? Eg 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).

eg 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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM