I'm using/experimenting with Zen on my drupal site, and have just inserted a js file named alert.js into my theme's js folder. The file has the following code:

  (function ($){
Drupal.behaviors.kiwiAlert = {
  attach: function(){
    alert('Hello World');

I followed up by making the necessary changes in my .info file, by inserting the following snippet:

 scripts[] = js/alert.js

Since my site is in development mode I've set the cache to be cleared/theme registry to be rebuilt upon each page load, but just in case I cleared my cache again. And nothing, the alert message doesn't show, why is this not working??

PS: I also tried the following code in the js file, in the same context, but to no avail :C

 alert("Hello World!!");

Any and all answers will be much appreciated :)

  • Strange, I added exactly what you have to a test site, and it worked for me. Are you adding this to a sub theme that isn't enabled?
    – Jance
    Jul 9, 2014 at 19:27
  • nope, it's enabled and is implemented as the default theme, I wonder what's causing this not to work.
    – Bakajuice
    Jul 9, 2014 at 19:30
  • If you open your page in chrome, use the inspector (right click, inspect element) and head over to the console, and you type Drupal.behaviors, is kiwiAlert in the list of behaviors loaded?
    – Jance
    Jul 9, 2014 at 19:32
  • theres actually an error in the console window the following: Failed to load resource: the server responded with a status of 403 (Forbidden)
    – Bakajuice
    Jul 9, 2014 at 19:34
  • well thats the problem but I have no idea as to why or how to fix it
    – Bakajuice
    Jul 9, 2014 at 19:35

1 Answer 1


Answered in comments, but just moving the answer here for posterity's sake.

The theme was loading the .js file, but the permissions were restricted, so the server was returning a 403 error. Changing the permissions fixed the issue.

  • well, don't I feel like the worst person ever, just made this account on drupal SE, the other account on stackoverflow has enough rep to upvote, this one doesn't. :( thanks for the help and hopefully my gratitude and a bit of my stupidity will serve as a metaphoric upvote, sorry :{
    – Bakajuice
    Jul 9, 2014 at 20:06
  • No worries, glad I could help!
    – Jance
    Jul 9, 2014 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.