I need add iframe with YouTube embed source via Dart but it throws an exception:
void main() {
String videoID = "1nXRkk7Szu4";
IFrameElement frame = new IFrameElement();
frame.width = "560";
frame.height = "315";
frame.src = "http://www.youtube.com/embed/$videoID";
frame.setAttribute("allowfullscreen", "true");
frame.setAttribute("frameborder", "0");
querySelector("#sample_container_id").children.add(frame);
}
Breaking on exception: SecurityError: Blocked a frame with origin "http://www.youtube.com" from accessing a cross-origin frame.
It is OK via JavaScript.
Script was updated.
UPDATE: I found the way. I added sandbox attribute with these values: "allow-same-origin allow-scripts" + I turned on HTML5 with suffix "?rel=0&html5=1" in the src.