I use this javascript in a UIWebvView to get the URL of a YouTube video.
getURL = [self.webView stringByEvaluatingJavaScriptFromString:@"function getURL() {
var player = document.getElementById('player');
var video = player.getElementsByTagName('video')[0];
return video.getAttribute('src');
}
getURL();"
];
It works fine on iPhone, but fails on ipad and returns @"". Both devices load the m.youtube.com website. Could anybody help me?