I may be a bit burned out, but is there something wrong with where I put the code on my site?
Live on my site, not working at all
http://japaneselanguagefriend.com/apptest.html
Here it is on JSfiddle working just fine.
http://jsfiddle.net/adeneo/PT523/3/
Thanks to Adeneo for helping with this code!
You're not including jQuery in your test page. The console says
Uncaught ReferenceError: $ is not defined
And you aren't including jquery.js either from a CDN or locally in your code.
Include
http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
in your page, or host your own copy locally. Using a CDN is recommended as a cached copy may already be available on the client, which speeds up page load times.
Always have your browser's error console open when testing and debugging JavaScript. You will catch and fix most if not all syntactical or technical errors with it open.
Related
I've been working on a Firefox extension (basically just a "content script" or "page mod", whichever term works for you) that works exactly as expected when I use "cfx run" but when I do "cfx xpi" and install it, nothing happens. In cfx run, my content script works perfectly, with no errors from the command prompt. If this is any help, I do see an error when I exit the test run:
###!!! [Child][DispatchAsyncMessage] Error: (msgtype=0xAA0001,name=PTexture::Msg
___delete__) Route error: message sent to unknown actor ID
But this looks different from JavaScript errors (and really looks more "internal" to me, something buggy about the SDK maybe?). Anyway, when I do cfx xpi (with or without the "--no
-strip-xpi" option) everything seems to work fine. No errors from the console, the installation seems to work), but when I go to the page I'm writing the script for, nothing happens. The page loads as it usually does, but the content script doesn't do anything; no changes to the page, no errors, really just no hint whatsoever of what the function is going on.
So of course I spent a bit of time on Google and also this site. I found a couple questions that were slightly similar but either unrelated or unanswered. Here are a few of these:
creating xpi does not work (this one was a mac vs. Windows issue)
Create XPI package with the Add-on SDK? (this one was kinda close but I didn't use contentScript in my main.js and did use the PageMod object like the guy suggested)
Firefox SDK Sample Add On Exported XPI Action Button Doesn't Show Up (My console didn't show any errors, so this one didn't help either).
And of course, I tried all the obvious stuff (restart Firefox, reboot the computer, change the content of the scripts, etc.) and the result is still the same: fine in cfx run, compiles and installs fine but does nothing after cfx xpi.
Also, in case it would be helpful to you guys, here's my main.js:
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.somepage.com",
// NOTE TO SELF: include all object files here.
contentScriptFile: [data.url("Data.js"), data.url("Layout.js"), data.url("HTML.js"), data.url("Restyler.js"), data.url("Shortcut.js"), data.url("ARIA.js"), data.url("Apricot.js")]
});
This follows closely with everything I've read in the documentation and tutorials, but still for whatever/no-good reason it only works in cfx run. So unfortunately, all I can really tell you for sure is that something somewhere is somehow blocking, overriding, or otherwise preventing the XPI from doing its thing (mysterious? Sure. Frustrating? You have no idea...). :))))
I'm sorry I'm not sure what else to say, lol. I know JavaScript (and a bunch of other languages) but this is my first attempt at using the SDK (which seems to be more trouble than it's worth). Gosh I wish they would update the GreaseMonkey compiler, or at least bring back the Add-On Builder... oh crap did I say that out loud? :)
All joking aside though, any potential solutions, workaround or other insights would be greatly appreciated. Thanks.
Are you using private browsing in your Firefox setup?
If so then you need to add
"permissions": {"private-browsing": true}
to the package.json file.
More information:
https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/private-browsing#Opting_into_private_browsing
The following error shows up when I load a page that uses jQuery in my iWebView.
I checked if the JS files have any errors, but they all seem fine.
Any clues anyone?
Vasa, the latest 1.x version is 1.11.1:
https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
You may want to try pointing to that to see if the upgrade has fixed your script error. Also, using the non-minified version for development may give you more detail to line and character.
I have the latest shock wave (11.9.900.117) add-on installed to my Firefox (24).
When i download and run the sample test.html file nothing is happening.But when i run the same demo linked (http://pixelgraphics.us/downloadify/test.html) HTML from Git hub works as expected.
Also i have tried this with my project too, same kind of output, nothing happens but the button hides.There are no error messages shown or can be caught since i cant go through the swfobject.js file.
I am using javascript alone, not jquery etc.
Is there anything that i am missing some basic stuffs?
Also asked in https://github.com/dcneiner/Downloadify/issues/34.
Any simple working examples would be helpfull.!!
Thanks in advance.
I know this question is old, but for anyone who encounters the same problem, here is how I solved it.
If you want to run Downlodify from the local filesystem you need to edit the Flash Player Global Security Settings and add the Downlodify folder as a trusted location.
Currently the settings can be edited here. The location URI looks like this file:///C:/Users/Name/Desktop/Downloadify-master
I try to debug a javascript function called from Generate Thumbnails plugin in Wordpress. The function uses jquery. So the actual call that I want to debug occurs in jquery.
The problem is that default jquery.js inside Wordpress is minimized and therefore obscure. I changed that file with the uncompressed version of jquery.js file in wp-includes\js\jquery.
But when I debug that function with Firebug's debugger, Firebug still shows me the old, minimized version of jquery:
I copied the location of the script file shown in Firebug and opened it in browser: http://localhost/wordpress/wp-admin/load-scripts.php?c=1&load=jquery,utils,jquery-ui-core,jquery-ui-widget&ver=368b0ffbc13bc55b5ae45ad40a5368d9
This time, the true, uncompressed version of jquery.js was opened.
It seems like Firebug opens the old version of jquery. I restarted the Firefox but it wasn't resolved.
What might be the reason of this problem? Is this Firebug related or Wordpress related?
I'd agree with the people who commented on your question - it seems like a browser cache problem.
If it's a test system, one thing I'd suggest is setting the WP_DEBUG constant to true in your wp-config. That'll download the uncompressed versions of the javascript libraries. That has two advantages:
You don't have to copy different javascript files around, and
The file names differ from the standard ones (they have .dev in them, from memory), so you shouldn't hit any caching issues.
I'm assuming there's an uncompressed version of jquery in WordPress. Apologies if there isn't; I haven't checked. But in general I'd recommend this approach.
See Debugging in WordPress in the codex for more information.
Okay, this is very weird...
http://connecttofriends.com/admin/login
I'm writing an administration control panel and am using a template from Theme Forest (because I didn't sign on to create any graphics, so my client bought it). For the login page listed above, I had to program it to run through Javascript due to the way it was set up.
I got it working and everything. Suddenly, though, something bizarre happened, and Javascript has not worked on that page at all since. None of my Javascript will even appear in Firebug, and I haven't been able to find anything to suggest that there's a Javascript error. Worse yet... on my local test server, it works perfectly fine. It just refuses to work on the live server for whatever reason.
Has anything like this ever happened before? How can I possibly fix this? I can't find anything wrong, and it works fine on my test server. I've at least been able to continue development on the test server, but without the live version working its useless.
I'll post code if people ask, but I don't see much of a reason to under these circumstances because the code actually works.
Any help is appreciated...
jQuery doesn't load.
It tries to fetch jQuery from this address: http://connecttofriends.com/admin/js/jquery-1.7.min.js, and it's not there. Missing a /, to indicate root?
the path you using is not loading, why dont you use jquery link as https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js
this'll also reduce your server hits.
jquery library is not getting loaded.Please check the path of the jquery-1.7.min.js.