1

I have an iFrame with custom website page loaded into it. I am trying to find a way to get the word or text the mouse was hold down over it on that page using JS. To make it more clear, when the mouse was hold down on a specific word on the web page I want to do some actions in JS.

How can I do this check? I dont' have control over the web page content, I may load this StackOverFlow Question in the iFrame and if the user clicked on this bold word I want to do some actions in JS.

Any idea?

Ahmad Alkhawaja
  • 529
  • 2
  • 12
  • 29
  • Avoid using iframes. HTML5 doesn't like them. Try using AJAX. That way, you'll be able to do what you want as well. – Some Guy Aug 15 '11 at 12:19
  • possible duplicate of [How can you access an external iframe's contents via the DOM/Javascript?](http://stackoverflow.com/questions/2374697/how-can-you-access-an-external-iframes-contents-via-the-dom-javascript) – Felix Kling Aug 15 '11 at 12:20
  • This is not about accessing iFrame content, it is about detecting the mouse down event is clicked on a specific word in the website page. – Ahmad Alkhawaja Aug 15 '11 at 12:35

1 Answers1

2

You won't be able to access the contents of external iframes for security reasons (this includes setting event handlers). This response explains it further.

Community
  • 1
  • 1
Alexander Gessler
  • 45,603
  • 7
  • 82
  • 122
  • I have no problem with accessing iFrame content, let's forget about iFrame for now, what I am tryig to achieve is how to know that mouse clicked on a word in the web page from JS. – Ahmad Alkhawaja Aug 15 '11 at 12:34