0

I have a simple HTML page with an iframe. I set its src to another HTML file and I can change the style of any chosen element at will using code like this (a basic example):

function elementStyle()
 {  
  var iFrame = document.getElementById( "iFrame" );
  var element = iFrame.contentWindow.document.getElementsByTagName(
"table" )[0];
  element.style.color = "#ff0000";
 }

However the src of the iframe must be an external URL and cross-domain restriction prevents me from accessing its elements. I have no control over its content so I can't use postMessage() because I can't receive any message posted. Any ideas of a way to get round this?

Note: it must work for anyone with any browser so musn't use any special methods (like jQuery, CORS etc). Thanks

0 Answers0