java - How to get content of iframe using GWT Query? -
i trying this:
$("iframe.cke_dialog_ui_input_file").contents()
but returns:
< #document(gquery, error getting element string representation: (typeerror) @com.google.gwt.dom.client.domimplmozilla::tostring(lcom/google/gwt/dom/client/element;)([javascript object(8570)]): doc null)/>
but document not null!
help me please solve problem :(
upd. html code:
<iframe id="cke_107_fileinput" class="cke_dialog_ui_input_file" frameborder="0" src="javascript:void(0)" title="upload image" role="presentation" allowtransparency="0"> <html lang="en" dir="ltr"> <head> <body style="margin: 0; overflow: hidden; background: transparent;"> <form lang="en" action="gui/ckeditor/fileuploadservlet?ckeditor=gwt-uid-7&ckeditorfuncnum=0&langcode=en" dir="ltr" method="post" enctype="multipart/form-data"> <label id="cke_106_label" style="display:none" for="cke_107_fileinput_input">upload image</label> <input id="cke_107_fileinput_input" type="file" size="38" name="upload" aria-labelledby="cke_106_label"> </form> <script> window.parent.ckeditor.tools.callfunction(90);window.onbeforeunload = function() {window.parent.ckeditor.tools.callfunction(91)} </script> </body> </html> </iframe>
the contents()
method returns htmldocument
, have find <body>
manipulate it.
$("iframe.cke_dialog_ui_input_file").contents().find("body");
a common mistake query iframe before has been loaded, code delay using timer
, scheduler
or gquery.delay()
. instance:
$("iframe.cke_dialog_ui_input_file") .delay(100, lazy() .contents().find("body") .css("font-name", "verdana") .css("font-size", "x-small") .done());
Comments
Post a Comment