views:

225

answers:

2

Taking http://youtube.com, http://justin.tv, http://ustream.tv as examples, is it possible to do the following:

  • Open the third party page in a pop up window
  • Analyze the height and width of the element
  • Resize AND offset the window contents to the size of the element

This would be specifically useful when embed is disabled by a particular site.

+1  A: 

Your script is not allowed to inspect or manipulate the DOM content of documents that come from a different host than the one for the page in which it runs.

That means that unless your scrip is running from the youtube.com domain, you will not be able to inspect or manipulate pages there.

levik
+1  A: 

While you can't resize the popup to the size of specific content (for the reason levik mentioned above) you can scroll directly to particular elements provided the third party site has decorated the element (or ancestors/siblings nearby) with an ID. I regularly use jQuery's nyroModal plugin for in-page popups (generally more user-friendly than full browser popups). NyroModal supports scrolling to an element (say a flash video with an id of "mainVideo") using a link such as:

http://example.com/thirdparty.html#mainVideo

Jason Karns