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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:39:02+00:00 2026-05-20T11:39:02+00:00

I’m currently developping a GreaseMonkey user script to provide a direct translation of some

  • 0

I’m currently developping a GreaseMonkey user script to provide a direct translation of some form fields inside an Intranet App.

Everything goes OK until I call Google Translation API using this code :

var apiurl = 'https://ajax.googleapis.com/ajax/services/language/translate?v=1.0&langpair=fr%7Cen&q=';
$.getJSON(apiurl+encodeURIComponent(text)+"&callback=?",function(data){
    alert('Translation Complete');
    //Change text
});

Here are my problems :

  • I’m forced to use JSONP as this is a Cross-Domain request. In order to do that, I added the &callback=? string at the end of my URL. The getJSON callback isn’t fired (but the response data is correct), and I get this error in the Firebug console :

jsonp1298988446807 is not defined

  • If I use a &callback=foo instead, FF doesn’t seem to like it, as my request is no longer a POST one, it doesn’t complete but it shows (in Network panel)

    OPTIONS request_url 405 Method Not Allowed

  • If I create a custom function to specify as callback, it doesn’t work either as the function isn’t called (it only contains an alert to check if it works).

If anyone has the slightest idea why this doesn’t work, please help me, because i’m this close to banging my head on the wall (maybe it would help ^^).

Thanks.


EDIT : Thanks to Scoobler, I believed I’ve gone a little bit further. Using his code, i’ve managed to get something more than a /ignore from my script ^^

The request does not appear in the network tab of Firebug, and the responses given by the alerts are :

Response text: undefined

Status returned: error

Error thrown: Error thrown: [Exception… “Component is not available” nsresult: “0x80040111 (NS_ERROR_NOT_AVAILABLE)” location: “JS frame :: file:///C:/Documents%20and%20Settings/username/Application%20Data/Mozilla/Firefox/Profiles/jmbr7ut9.default/extensions/%7Be4a8a97b-f2ed-450b-b12d-ee082ba24781%7D/components/greasemonkey.js :: anonymous :: line 396” data: no]

In the mean time, I kept researching on my own, and came across a jQuery/GreaseMonkey bridge for cross-domain requests, with a complete walkthrough here (from this post), but this shows the exact same error than Scoobler’s script

  • 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-20T11:39:02+00:00Added an answer on May 20, 2026 at 11:39 am

    In fact, there is a function in GreaseMonkey API, that allow Cross Domain request without any special parameters [mirror].

    Using this made the script work instantly.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.