I seem to be getting the following error

Uncaught ReferenceError: Drupal is not defined

which relates to

if (Drupal.settings && Drupal.media_youtube) {

doesn't seem to stop it working though

Comments

steinmb’s picture

Have you tested with the dev. release, and what do you do to trigger this error?

RobW’s picture

Status: Active » Closed (cannot reproduce)
RobW’s picture

Title: Drupal is not defined » Uncaught ReferenceError: Drupal is not defined
Version: 7.x-1.0-alpha5 » 7.x-2.x-dev
Status: Closed (cannot reproduce) » Active

Aaaaand I can reproduce it now.

You'll find the error in the javascript console, for anyone interested.

RobW’s picture

Status: Active » Closed (works as designed)

OK, the answer:

Drupal.settings is a javascript object used to pass settings from the backend to the frontend. It usually stores js settings that are specific to a single page or state.

I was getting this error because I stripped out mysite/misc/drupal.js (where I believe the original object is created) with some agressive "eff you I'll write everything on the frontend myself" template functions. When jQuery.extend tries to add the page specific properties to the object it throws an error because the object hasn't been defined.

I'm guessing you've done something similar, and I'm 100% sure this isn't a M:YT issue, especially because M:YT no longer passes any variables to Drupal.settings. Thanks for opening though: I learned about a piece of Drupal frontend code that I don't want to strip out, which usually only happens with blood sacrifice during a full lunar eclipse.

ColemanTO’s picture

Try adjusting your performance settings - only Safari could handle the settings I chose.

omar alahmed’s picture

it's regrading to the order of misc/drupal.js file. it should be included before the place that you use Drupal.settings or Drupal.behavior.

source: http://drupal.stackexchange.com/questions/56940/referenceerror-drupal-is...