我有一个名为htmlString
我放置 iframe 和 javascript 的字符串。但不知何故,我的 javascript 没有运行。然后我用来loadHTMLString
加载 html。需要找出问题所在。
NSString *htmlString = [NSString stringWithFormat:
@"<html><head><meta name = \"viewport\"content = \"initial-scale = 1.0, user-scalable = no\"/><script type=\"text/javascript\">"
@"alert (\"hello1\")"
@"function ready() {"
// Keep a reference to Froogaloop for this player
@"var player = $f(player),"
@"$fplayer.api('play');}"
@"window.addEventListener('load', function() {"
@"alert (\"hello\")"
@" $f(player).addEvent('ready', ready);"
@" });"
@" </script></head><body><iframe id=\"player\" src=\"http://player.vimeo.com/video/8118831?api=1&player_id=player\" width=\"320\" height=\"480\" frameborder=\"0\" webkitallowfullscreen allowfullscreen></iframe>"
@"</body></html>",@"http://www.vimeo.com/8118831"
];