Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3851152
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:07:07+00:00 2026-05-19T17:07:07+00:00

Not more than ten minutes ago I decided to write my first script for

  • 0

Not more than ten minutes ago I decided to write my first script for Greasemonkey. I have zero experience with it. Also, my JavaScript is a bit rusty as it’s been a while since I last wrote code in it. But I can’t figure out why Greasemonkey is giving me this error:

Line: 9 
Char: 2 
Error: 'document' is undefined 
Code: 800A1391 
Source: Microsoft JScript runtime error

Here’s my script:

// ==UserScript==
// @name           Easier WatchSeries
// @namespace      n/a
// @include        http://www.watch-series.com/episode/*
// ==/UserScript==

function thing()
{
    document.body.setAttribute('onload', show_links(document.getElementById('idepisod').value));
}
thing();

All I want to do is add an onLoad attribute to the body tag. I get this error when I go to “Manage New User Scripts” -> “Edit”. Other than that the script does nothing so obviously something is wrong.

I’m running Firefox 3.6.13.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:07:08+00:00Added an answer on May 19, 2026 at 5:07 pm

    Several things:

    1. That cryptic error message has been found to happen when Greasemonkey does not have a proper editor set up.

      1. Open about:config in your browser.
      2. Filter on greasemonkey.editor.
      3. Enter a valid path to a valid editor. I like TextPad, but c:\Windows\System32\notepad.exe should work on most windows systems.
      4. You might need to restart Firefox.
    2. Event listeners cannot be added that way due to Greasemonkey’s sandbox/security. See GM pitfalls, event handlers.

    3. You need to use unsafeWindow to call a page’s JS functions, like show_links().

    4. When using complicated ajax functions that often fail, it’s a good idea to wrap them in try - catch blocks.

    5. That page switches between http://www.watch-series.com and watch-series.com, so both need to be in the @include directives.

    Putting it all together, your script would become:

    // ==UserScript==
    // @name           Easier WatchSeries
    // @namespace      n/a
    // @include        http://www.watch-series.com/episode/*
    // @include        http://watch-series.com/episode/*
    // ==/UserScript==
    
    function my_func()
    {
        try
        {
            unsafeWindow.show_links(document.getElementById('idepisod').value);
        }
        catch (zError)
        {
            alert (zError); //-- Use console.log() in place of alert(), if running Firebug.
    
        }
    }
    
    window.addEventListener ("load", my_func, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have waited for more than 72 hours but ecommerce data is not tracked.
Why it would not commit (I had done more than 200 commits on my
I have an array with more than 134675+ values, I need to insert them
I'm new to data warehousing. First, I want to precise than my copy of
How can I pass more than one parameter from jQuery to an ASHX file.
How can we use more than one instruments at the same time ? I'm
We have a bunch of VB6 applications that access two different database servers (both
I have this web app that is running ASP .NET MVC 1.0 with LINQ
I've got a contract to write part of a program. The person writing the
Last week I wrote a few lines of code in C# to fire up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.