Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post

    Getting whole content of iframe.

    What wrong in this code?
    Code:
    <script type="text/javascript" src="jquery.js"></script>
    <script>
    	$(function (){
    		function manda(){
    			var text =                      $('#frame').contents().find('p[class=no_boder]').html();
    			$('div').html(text);
    		}
    	});
    </script>
    i've already tried using this ->
    $('#frame').contents().html();

    How can i get the content?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,210
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Question: Do the iframe contents come from the SAME DOMAIN as your main page? If not, nothing you can do will get the contents, as cross-domain scripting is not allowed (with a couple of very limited exceptions that only apply if you "own" the code used in both domains).

    Oh, and by the by, this is a jQuery question, not strictly JavaScript. I have no idea if your syntax is correct in jQuery. You might want to post in the jQuery forum to get the experts there involved.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •