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 8351581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:40:36+00:00 2026-06-09T08:40:36+00:00

I have a JavaScript bookmarklet that is working fine in Chrome (v21) and Safari

  • 0

I have a JavaScript bookmarklet that is working fine in Chrome (v21) and Safari (v6) but when I try to use it in Firefox (v14) or IE (v9) and I get a page that just says:

[object HTMLScriptElement]

The bookmarklet is this (all the PHP statement at the end inserts the API key):

javascript: (function(src, cb) {
var s = document.createElement('script');
s.charset = 'UTF-8';
document.body.insertBefore(s, document.body.firstChild);
s.src = src;
if (typeof cb === 'function') {
    s.onload = cb;
    s.onreadystatechange = function() {
        (/loaded|complete/).test(s.readyState) && cb(s);
    };
}
return s;
}('http://towatchlist.com/marks/bookmarklet2response?uid=<?php echo $userID; ?>'))​

I don’t think it’s even loading the bookmarklet at all. In Firefox the URL bar changes to be the code above; in IE it doesn’t even change from whatever page it’s on.

I did try wrapping the bookmarklet in a self-executing function expression as suggested elsewhere, but that just resulted in
Uncaught SyntaxError: Unexpected token ( in the Chrome console (and nothing else). Here’s how I wrapped it:

javascript: (function() {
function(src, cb) {
    var s = document.createElement('script');
    s.charset = 'UTF-8';
    document.body.insertBefore(s, document.body.firstChild);
    s.src = src;
    if (typeof cb === 'function') {
        s.onload = cb;
        s.onreadystatechange = function() {
            (/loaded|complete/).test(s.readyState) && cb(s);
        };
    }
    return s;
}('http://towatchlist.com/marks/bookmarklet2response?uid=<?php echo $userID; ?>')
}());​

Perhaps I didn’t wrap it quite right? In any case, what do I need to change in order to make IE/Firefox actually execute the bookmark?

  • 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-06-09T08:40:37+00:00Added an answer on June 9, 2026 at 8:40 am

    A bookmarklet must not return anything. Just remove the return s; line and you should be good.

    More generally, you can wrap the whole thing (or more accurately the last statement) in a void() function call to ensure that there is no return value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've developed a JavaScript Bookmarklet that have appended div to the current page. But
I have a JavaScript bookmarklet that I'd like fans of a certain page to
I have this bookmarklet, i.e. it does not start with 'http:' but with 'javascript:'.
I have a Javascript bookmarklet that, when clicked on, redirects the user to a
Ok, I have a simple javascript function in a bookmarklet that finds all of
I'm trying to get a simple bookmarklet working with Rails that creates a form
I'm working on a bookmarklet that loads Javascript from my server. The JS adds
I have run into an odd situation. I'm writing a JavaScript bookmarklet that will
Background: I have written a bookmarklet (JavaScript) that appends an iframe to the current
Background: I have written a bookmarklet (JavaScript) that appends an iframe to the current

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.