jquery iframe html() - I can access to iframe, but can't get its content -


this has been discussed several times, can't make work.

i've 1 iframe created on fly, can acess properties, width or css styles, can't access innerhtml.

this code, i'm missing here?

thanks!

var iframe = document.createelement('iframe'); iframe.frameborder = 0; iframe.width = '100%'; iframe.height = '180px'; iframe.src  = 'javascript:void(0);'; iframe.id = '_input_'+que_evento_id; $(iframe).css('margin-top', '5px'); $(iframe).css('background-color', '#ffffff'); $(iframe).css('border', 'solid 1px #ff7223'); var conteudo = $('#span_'+que_evento_id+'').text(); var doc = '<html><head><meta http-equiv=\'content-type\' content=\'text/html; charset=utf-8\'><title>editar</title></head><body style=\'padding:5px\'>'+conteudo+'</body></html>'; iframe_doc = iframe.contentwindow.document; try {     iframe_doc.designmode = 'on'; } catch ( e ) {     $(iframe_doc).focus(function() { iframe_doc.designmode(); } ); } iframe_doc.open(); iframe_doc.write(doc); iframe_doc.close();  width = $('#_input_'+que_evento_id+'').attr('width'); console.log(width); // returns 100% wich correct o_que_vamos_editar = $('#_input_'+que_evento_id+'').contents().find('body').html(); console.log('log '+o_que_vamos_editar); // returns "log " 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -