0

How can I change the scr of an iframe, that's in another iframe?

example: http://tomtopchina.blogspot.ro/

I want to change "what is my referer" page that's inside "mypayingcryptoads" that's inside "tomtopchina.blogspot", so can I access so deep?, it needs to be in javascript

  • Nope, not possible, because the first iframe is loaded from a different domain already - so the Same Origin Policy of course prevents you from accessing any of its content using client-side scripting. – CBroe May 28 '18 at 14:45
  • 1
    Provided that you have code-access to the first iframe you could use PostMessage (https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) to communicate between the two – Jannik Lehmann May 28 '18 at 14:47
  • Good idea. Might not work in this case. It seems he is not in control of the first iframe... – Domenik Reitzner May 28 '18 at 14:51
  • TomTopChina + MyPayingCryptoAds = ☠ – zer00ne May 28 '18 at 15:03

1 Answers1

0

You could try using contents with jQuery

let iframe = $('#some-id').contents().find('html').html()

and then do a string replace and then write it back like

$('#some-id').contents().find('html').html(iframeHtmlChanged)

Pulled from here

Domenik Reitzner
  • 1,583
  • 1
  • 12
  • 21