Search Results

Search found 1 results on 1 pages for 'mhammout'.

Page 1/1 | 1 

  • Dynamically created iframe not working on Safari

    - by mhammout
    I have a weird problem and I find no answer on google... I dynamically create and fullfil an iframe with jquery on a page. It works fine withFF and IE, but not with Safari. The iframe is created but empty (the message "greetings from the iframe !" is missing). Here is a piece of code to illustrate it : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-fr" lang="fr-fr" > <head> <title>iframe</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var jFrame = $('<iframe id="myiframe" name="myiframe">'); jFrame.css({'height':'40px','width':'200px'}).appendTo($('#container')); $('#myiframe').load(function() { jFrame.contents().find("body").html('greetings from the iframe !'); }); }); </script> </head> <body> <div id="container"></div> </body> </html> I really wonder why the iframe stays empty with Safari. It seems like if "contents()" was not well interpreted... Any idea ?

    Read the article

1