0

How i implement css in iframe my url is from cross-domain please help me how to do that.

Please check my code:-

<iframe allowtransparency="true" frameborder="0" height="1200" 
  id="cpatsframe" scrolling="no" src="https://Ghost.Org/jobs? 
       aggregator_id=180015&amp;embed=1" style="position: relative; 
    overflow: hidden; height: 2909px;" width="100%">Sorry, iframes are not 
  supported.</iframe>


   <script>

    $("#myframe").contents().find(".myclass").css('background', 'red');


    </script>

But this is not working Please tell me how i fix that or work it. Thanks alot In advance

1 Answers1

0

Try this if iframe is in same domain

 <script>
    $(document).ready(function(){
        var iFrameDOM = $("iframe#cpatsframe").contents();
        iFrameDOM.find(".myclass").css("background-color", "red");
    });
</script>

else There is no way to edit a Cross Domain IFrame. You can manipulate domains within the same level, or lower in your domain chain but there is no way to made changes in cross domain iframe.