Modifying content of iframe

Modifying content of iframe

Hello

I need to modify the content of an iframe. I have tried many approaches, have not yet found a working solution though. :(

I do understand that there is a same origin policy, but I have disabled it via JS for Firefox and I have also tried Chrome with --disable-web-security.

The following example works when I use a relative path like "test.html", It does however not work with a complete URL.

Does anyone have an idea about this?

Thank you so much!
  1. <!DOCTYPE html>
    <html>
    <head>
      <script src="http://code.jquery.com/jquery-1.5.js"></script>
      <script>
      if (navigator.userAgent.indexOf("Firefox") != -1) {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
        }
        catch (e) {
            alert("Permission UniversalBrowserRead denied -- not running Mozilla?");
        }
    }
    </script>

    </head>
    <body>
      <iframe src="http://api.jquery.com/" width="80%" height="600" id='frameDemo'></iframe>
    <script>

    var myFrame = $('#frameDemo');
    myFrame.load(function(){
        myFrame.contents().find('a').css("background-color","#FF0000");
    });

    </script>

    </body>
    </html>