2

Let's say I have a website called https:// www.mysite.com. I am trying to figure out how I can capture events (like button click) on some other site (say - https://www.othersite.com that is willingly loaded) inside of mysite (something like a iframe).

Note: I do not have access to https://www.othersite.com

Something like :

<my-site>

// load external site https://www.othersite.com here

</my-site>

I tried using iframes but I realised it's not possible due to Same Origin Policy. (Please do not suggest the php solution with file_get_contents. I have gone through all the articles here on stackoverflow in the last couple of days but could not find a JS solution to this).

Basically, I was looking at something similar to Selenium IDE (It's extension here) where I want to capture events carried out by the user on https://www.othersite.com but its loaded on/inside mysite.

Any pointers to what can be some of the right approaches/strategies for solving this? This is very fundamental question in what I am trying to achieve and I want to do it the right way. Any guidance is greatly appreciated!

HiddenMarkow
  • 603
  • 1
  • 7
  • 19
  • What do you mean by "something like an iframe". Is it loaded in an `iframe`? – Drenai May 22 '21 at 21:08
  • Pretty sure you don't have any options other than the one you don't want to do (scraping their content with something like PHP). And really, you shouldn't be able to do it without the consent of the other site for security reasons. – Kinglish May 22 '21 at 21:10
  • That's called cross site scripting and browser vendors work hard to make sure you can't do it. – pguardiario May 23 '21 at 02:23
  • @Drenai I mean I am exploring options. How do you think the selenium IDE does it? It is not a iframe I believe. By saying "something like an iframe" I wanted to establish that I am not rigid on it being an iframe but something similar in its features. – HiddenMarkow May 24 '21 at 20:18
  • @Kinglish I see that the Selenium IDE does all the things that I want but not sure how they do it. – HiddenMarkow May 24 '21 at 20:19

0 Answers0