M
M
m0dE2013-06-03 10:10:28
Opera
m0dE, 2013-06-03 10:10:28

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 ]

In Chrome and Firefox, I can get the address I need from the iframe: And Opera always returns about:blank, and besides, it does not display the contents of the iframe ... I.e. the video itself is uploaded, but I can't get the correct video ID. Now I will describe in more detail how I create the form and frame:
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'
});

Sorry, maybe a very stupid question, all the time I sit only in Chrome ... Is it possible to somehow solve the problem with Opera?
Thanks!!!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
m0dE, 2013-06-03
@m0dE

What nobody knows?

M
mamchyts, 2013-06-03
@mamchyts

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'
});

Because window should be equal to iframe, and you want it to be parent.

M
mayorovp, 2013-06-04
@mayorovp

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>

It remains to make the upload_done function in the main frame

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question