thinkfuture
thinkfuture

Reputation: 41

Javascript/iframe/embed/object question

OK, so here is my issue. I'm building a system which will allow people to embed lists of links on their pages. When the link is clicked, i'd like to use something like Lightview or Lightwindow to open it up over the whole window, not just in the iframe.

I don't have access to the page that the user will be embedding this object into. Everything I've tried so far tells me that I can't open anything over the parent window, since I don't have access to it from the iframe or object, javacript security issue.

However, I've seen sites that do that kind of overlay. so it must be possible. If anyone can point me to any resources that could help, that would be great.

if it matters, i'm using Ruby on Rails...

Thanks...chris

Upvotes: 0

Views: 1165

Answers (2)

Sean Kinsey
Sean Kinsey

Reputation: 38046

As vsync said, you will have to have the user embed a script instead of the plain HTML.

This script has full control of the page, and if you also want it to be able to communicate with the framed document (your site), then you could use something like easyxdm to do cross document communication.

Upvotes: 0

vsync
vsync

Reputation: 130175

It can't be done if the iframe is from another domain than the website, because:

  1. You cannot change the dimensions of the iframe from within it.
  2. You cannot access the parent document from within the iframe.

I suggest trying using some sort of JS file people will embed in they're website, in the place they want your links to be (something like Google Ads) and do a document.write to place your links in their webpage. then, you will have access to the page, and can do a whole lot more :)

is this helping you?

Upvotes: 2

Related Questions