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

  • SEARCH
  • Home
  • 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 need to ensure that a given field does not have more than one
I have more than 400 000 id's in NOT IN statement. Whether it will
I have settings dialog with a number of ComboBoxes. More often than not, these
I need to write some system log data (usually not more than 100 characters
i have an ASP.NET application (website, catalog-like). No high load expected (not more than
I have a log file that is not more than 10KB (File size can
I have a simple data set, a few collections, not more than 20 documents
I have a large set (100k) of short strings (not more than 100 chars)
If there are more than one rows in my source that do not match
I'm not quite sure what field to use when adding more than 30 days

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.