Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting clicks inside an iframe from outside?

Here is the scenario. There is content loaded in iframe from other site. I click to some link inside the iframe.

Is it possible to catch somehow outside the iframe what is that link?

UPDATE Since I recieved question if my intentions are pure, I would explain more on the use case. May be I started in wrong direction for this task.

So, we have a desktop client that walks around web (for shoping actually) and when customer finds something she wants to buy, she clicks on "that" (anything - picture, link, address) and send "that" to our service where it is manually resolved to link to product and transformed to entry in her register. Nothing unusual.

Now, the task is to make it web app. So, customer registers in our site and starts browsing internet stores. Hence my first choice was iframe. But the question is how to find what she clicked on?

Or, generally - how to save a "bookmark" to some object from the other site?

like image 667
user34577 Avatar asked Jun 13 '26 07:06

user34577


2 Answers

If the pages are not located on the same domain then there is no way to do this. Your scripts cannot see across domains.

like image 62
Prestaul Avatar answered Jun 16 '26 07:06

Prestaul


If it is from another site then the only way I know is to write the information you need to iframe's window.name property.

That, you can read from your main documnent.

like image 45
pkario Avatar answered Jun 16 '26 07:06

pkario