I use jQuery's excellent and simple dialog command to open a dialog box in front of some built-in third-party content. This embedded content can be a page from any website. I can get this to work on some sites (Yahoo, Google), but I can't get it to work on other sites (MSN, Johnlewis, FT).
I removed as much as possible from the code below to give a bare-bone problem - the code, how it is displayed, works fine, and the dialog box does show up. But, comment out the YAHOO line and uncomment the MSN line, then the dialog will not be displayed!
<head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script> <style> .ui-widget-header { border: 1px solid #aaaaaa; background: #1f84f5 url(images/ui-bg_highlight-hard_75_1f84f5_1x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; font-size: 20pt; } .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; font-size: 20pt;} </style> <script> $(document).ready(function() { $( "#thedialog" ).dialog( "destroy" ); $( "#thedialog" ).dialog({height:400, width:600, modal: true, buttons: {Cancel: function() {$( this ).dialog( "close" );}} }); }); </script> </head> <body> <?php <div id="thedialog" title="Simple dialog box" style="display:none">My girl lollipop</div> </body>
The only thing I can think of is that there must be something on one of the non-working websites that contradict my code - I tried everything to trap the problem, but I can not find the reason for this.
Can anybody help me?
NOTES: - (1) I know that the example, as shown, does not need PHP, but a more complete version (I just deleted most of the PHP code to keep this example small). - (2) I use jQuery elsewhere on the page in a more complete version, so ideally I would like to stay with jQuery, instead of introducing an alternative structure / method.
Steve source share