Answer the question
In order to leave comments, you need to log in
Problem with iframe in Opera?
Good afternoon. The video is uploaded to a specific Youtube channel on the site itself. With the help of JS, a form and an iframe (name="myframe") are created, for the form I specify this created iframe through the target attribute . In the Youtube API itself, after downloading the video, a redirect is made to the url containing the GET status and id parameters:
testik.ru/upload.php?status=200&id=[id_video ]
window.frames['myframe'].location.href
//Ответ от Youtube-API
json = {
url: [url_from_youtube]?nexturl=[my_url],
token: [access_token_from_youtube]
}
var form = $('<form action="' + json.url + '" method="post" enctype="multipart/form-data">');
form.attr('id', 'iform');
form.appendTo(document.body);
form.css({
'position': 'absolute',
'top': '-50%',
'left': '-50%'
});
var file = $('#' + fileId);
file.attr('name', 'file');
file.appendTo(form);
var hidden = $('<input type="hidden" name="token" value="' + json.token + '">');
hidden.appendTo(form);
var iframe = $('<iframe>');
iframe.css({
'position': 'fixed',
'top': '50%',
'left': '50%',
});
iframe.attr('name', 'iyoutube');
frame.attr('id', 'iyoutube');
iframe.appendTo(document.body);
form.attr('target', 'iyoutube');
form.submit();
iframe.load(function() {
var uri = window.frames['iyoutube'].location.href;
console.log(uri); // Opera return 'about:blank'
});
Answer the question
In order to leave comments, you need to log in
It is not entirely clear how this works, but it seems to me that the matter is somewhere here:
iframe.load(function() {
var uri = window.frames['iyoutube'].location.href;
console.log(uri); // Opera return 'about:blank'
});
As I understand it, after uploading the video, a redirect is made back to your site, and you want to know the id from there?
Well, put the code on this page
<script>
if (parent.upload_done)
parent.upload_done(..., ...);
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question