1

I'm trying to create somewhat of a highlighting/selecting tool [using jQuery] in my web app that watches what elements you hover over inside an iFrame, selects the hovered-over element, and uses that element's styling to create on overlaying <div>. Think of the element selection tool in your web inspector.

Here's a demo uses p,a, and h2 elements as the selector (hover over one): http://jsfiddle.net/ST539/1/

The problem I'm having is that this only seems to work on some web pages, and I'm not sure what is causing this. Here's another demo using example.com: http://jsfiddle.net/ST539/2/

No highlight on any elements. Anyone know what's up?

4

1 回答 1

0

同源政策。JavaScript 不能从不同的域访问iframed 。document

有一些解决方法,但大多数干净的方法需要在其他域的页面中进行一些设置。请参阅:规避同源策略的方法

于 2013-04-26T02:48:01.077 回答