Replace url from youtube to insert code - Error: Permission denied to access the 'toString' property

I have this code and this error in FireBug:

Error: Permission denied to access the 'toString' property

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

DEMO: http://jsfiddle.net/9e48p/

+43
javascript jquery youtube
Oct 27 '12 at 13:30
source share
5 answers

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

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

For what it's worth, I see that this error occurs when any flash file, even those that do not have ActionScript calls (ExternalInterface, etc.) in them at all, is loaded into an iframe on the page where the page domain and iframe domain is different. This means that the iframe problem occurs when there is actually a cross-domain situation in place. However, it is not entirely clear whether the attempt to be a cross-domain call that should be prevented is indeed Error.

Because it’s not that Flash SWF itself is trying to call “Location.toString” and nothing is said about javascript on the page doing this, the only choice is that there is something about the flash plugin itself (9.0.124 is what I'm testing) trying to do which call up to the parent / top window to do Location.toString ().

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

Update:
The error was registered in Adobe, as well as in the old error database: FP-561 An exception to the unreceived (security) Location.toString object caused by the incorrect behavior of the Flash plugin (you need an account to see details about the errors). The last comment there when the error was closed:

Tested with the latest Flash Player 10.3.181.34 on Firefox 4 and 5, no such exception has been thrown. So the error could be fixed, right? If you are still encountering this problem, please write a bug in our new error system https://bugbase.adobe.com/ and put the link in a new bug for this original JIRA report. We are pleased to follow your report in the new error system.

+67
Oct 27
source share
— -

Do not ignore this error just because it is not directly related to your code.

It seems to happen when your insert is hidden.

Just add ?html5=1 to your url. IE8 will still use the flash version. or upload your video using the Youtube api application.

+48
Nov 13 '13 at 9:12
source share

Something is probably wrong with your iframe url constructor. The error is called in the youtube script, which is loaded in the Iframe. The same error is generated using the hcml iframe, which is not dynamically added using the script

 <iframe width="390" height="315" src="http://www.youtube.com/embed/UNMLEZrukRU" frameborder="0" allowfullscreen></iframe> 

HTML version only http://jsfiddle.net/Lgt5f/

Double url check does not skip parameter, otherwise I would check youtube support resources

+2
Oct 27
source share

This problem may be caused by a broken extension.

Launch Firefox in the “Troubleshooting Firefox” section using safe mode to check if one of the extensions or hardware accelerates problems (switch to the DEFAULT theme: Firefox / Tools> Add-ons> Appearance / Themes).

+1
27 Oct '12 at 13:33
source share

Ignore this error, it is not related to your code. Just a browser bug.

0
Oct 27
source share



All Articles