iTunes LP/Extras Javascript redirects

For iTunes LP and iTunes Extras content programatically loading a link is very difficult. Both iTunes and AppleTV don’t support the Javascript function windows.open() or the property window.location. I’ve managed to come up with this bypass (aka hack) which is demonstrated in the Javascript code below. It triggers a mouse click event emulating the user manually clicking a link on the page.

//click a link with id 'my_link'
clickLink(document.getElementById('my_link'));

function clickLink(elementId) {
	var elm = document.getElementById(elementId);

	//set up mouse click event
	var evt = document.createEvent('MouseEvents');
	evt.initMouseEvent('click', true, true, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0,  null);

	//trigger click event on html element
	elm.dispatchEvent(evt);
}
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
articles a bit like this one:
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>