javascript - Why doesn't document.getElementById(id).contentWindow work for local htm files in Chrome? -



javascript - Why doesn't document.getElementById(id).contentWindow work for local htm files in Chrome? -

i've been trying edit pages local htm files on computer, i've run problem functions using contentwindow property don't work when parent page , page within iframe local files. when pages uploaded exact same codes work fine, not local files. it's in chrome , opera i've had problem. in firefox , safari , net explorer contentwindow works fine local files.

this annoying because i've got dynamic iframe resize in page i'm working on , don't want have reupload pages every time want test them in chrome main browser.

is there sort of security setting in chrome (and opera) that's causing problem, , if can disabled?

the code just:

function resizeiframe(iframename) { document.getelementbyid(iframename).style.height = '1000px'; newheight = document.getelementbyid(iframename).contentwindow.document.body.scrollheight; settimeout(function () { document.getelementbyid(iframename).style.height = newheight + 'px'; }, 10); }

as turns out, is security thing, there's no way turn off settings menu. way (so far i've found) turn off (in windows) open chrome command prompt window typing file path , adding --allow-file-access-from-files command line. works opera.

unfortunately doesn't turn off permanently have open browser way every time want test page uses contentwindow property. works out okay when i'm using chrome because maintain open on computer time anyway, it's little annoying when want test in opera. maybe else post way of making permanent, have do.

sources:

is future releases of chrome back upwards contentwindow/contentdocument when iframe loads local html file local html file?

http://www.chrome-allow-file-access-from-file.com/

javascript google-chrome iframe resize autoresize

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -