将来自 youtube 的 url 替换为嵌入代码 - 错误:访问属性“toString"的权限被拒绝 [英] Replace url from youtube to embed code - Error: Permission denied to access property 'toString'

查看:19
本文介绍了将来自 youtube 的 url 替换为嵌入代码 - 错误:访问属性“toString"的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 FireBug 中有这个代码和这个错误:

I have this code and this error in FireBug:

错误:访问属性toString"的权限被拒绝

Error: Permission denied to access property 'toString'

我该如何解决这个错误?

How can i fix this error?

HTML:

<div class="yturl">http://www.youtube.com/watch?v=UNMLEZrukRU</div>

JS:

$("div.yturl").each(function(){
    var regex = /(?v=|&v=|/d/|/embed/|/v/|.be/)([a-zA-Z0-9-\_]+)/;
    var youtubeurl = $(this).text();
    var regexyoutubeurl = youtubeurl.match(regex);
    if (regexyoutubeurl) 
    {
         $(this).html("<iframe width="390" height="315" src="http://www.youtube.com/embed/"+regexyoutubeurl[2]+"" frameborder="0" allowfullscreen></iframe>");
    }
});

演示: http://jsfiddle.net/9e48p/>

推荐答案

该错误可以由 Adob​​e 的 Flash Player 团队修复,也可以由 Google 工程师修复 - 您现在应该忽略它.它连接到 Flash Player 安全设置和嵌入 Youtube 页面的 SWF 文件.IBM 过去曾报告过该问题,并且有也是 Mozilla Bugzilla 条目.

The error can either be fixed by Adobe's Flash Player team, or by the Google engineers - you should just ignore it for now. It's connected to Flash Player security settings and the SWF file embedded into the Youtube page. The problem has been reported in the past by IBM, and there is a Mozilla Bugzilla entry as well.

当我在 Firefox 16.0.2 中停用 Flash Player 时,错误消息消失.检查评论 #37:https://bugzilla.mozilla.org/show_bug.cgi?id=434522#c37

When I deactivate Flash Player in Firefox 16.0.2, the error message disappears. Check comment #37: https://bugzilla.mozilla.org/show_bug.cgi?id=434522#c37

不管怎样,当任何 flash 文件时,我看到这个错误发生,甚至那些没有 actionscript 调用(ExternalInterface 等)的它们完全加载到页面域的页面上的 iframe 中和 iframe 域不同.这意味着 iframe问题是在实际上存在跨域情况时引起的地方.然而,是否真的存在还不是很清楚试图成为应该被阻止的跨域调用,并且出错了.

For what it's worth, I'm seeing this bug happen when any flash file, even ones that have NO actionscript calls (ExternalInterface, etc) in them at all, is loaded into an iframe on a page where the page domain and the iframe domain are different. This means that the iframe problem is caused when there is in fact a cross-domain situation in place. However, it's not totally clear if there's really actually attempting to be a cross-domain call that should be prevented and error'd out.

因为 Flash SWF 本身并没有试图调用它Location.toString",与页面上的javascript无关这样做,唯一的选择是有关于闪光灯的东西试图制作的插件本身(9.0.124 是我正在测试的)调用父/顶部窗口执行 Location.toString().

Because it's nothing that the flash SWF itself is trying to call to do "Location.toString", and it's nothing about the javascript on the page doing it, the only choice is that there's something about the flash plugin itself (9.0.124 is what I'm testing with) that's trying to make that call up to the parent/top window to do Location.toString().

虽然错误被标记为已解决,但附加的测试用例 https://bug434522.bugzilla.mozilla.org/attachment.cgi?id=321956 在最新的 Firefox 版本(在 Firebug 控制台或 Firefox 错误控制台窗口)中产生相同的错误消息.

While the bug is marked as resolved, the test case attached https://bug434522.bugzilla.mozilla.org/attachment.cgi?id=321956 produces the same error message in the latest Firefox version (both in the Firebug console, or the Firefox Error Console window).

更新:
该错误也已在旧的错误数据库中提交给 Adob​​e:FP-561 "Location.toString" 由不当 Flash 插件行为引起的未捕获(安全)异常(您需要一个帐户才能查看错误详细信息).关闭错误时的最后一条评论:

Update:
The bug has been filed with Adobe as well in the old bug database: FP-561 "Location.toString" uncaught (security) exception caused by improper Flash plugin behavior (you need an account to see the bug details). The last comment there when the bug was closed:

在 Firefox 4 和 5 上用最新的 Flash Player 10.3.181.34 测试,没有抛出了这样的异常.所以这个错误可能已经修复了,对吧?如果您仍然遇到此问题,请在我们的新错误系统中提交错误https://bugbase.adobe.com/ 并在新错误中添加指向此的链接原始 JIRA 报告.我们很高兴在新版中跟进您的报告错误系统.

Tested with the latest Flash Player 10.3.181.34 on Firefox 4 and 5, no such exception was thrown. So the bug may have been fixed, right? If you still meet this issue, please file a bug in our new bug system https://bugbase.adobe.com/ and put a link in the new bug to this original JIRA report. We are happy to follow up your report in the new bug system.

这篇关于将来自 youtube 的 url 替换为嵌入代码 - 错误:访问属性“toString"的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆