Arrow

Javascript generated image not showing | Peter's Custom Anti-Spam for WordPress | Forum

Back to the custom anti-spam plugin page

Please consider registering
guest

Log In

Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Javascript generated image not showing
November 16, 2008
3:27 pm
openvista
Guest

I’m using WP 2.3.3 and I just updated to anti-spam 3.1.1 and enabled the javascript feature for spam code generation since I use caching (1 Blog Cacher). Even if I do a hard refresh (IE 7/FF 3/Safari 3), it won’t display the image. When I view source code I see that the javascript document.write methods in your AJAX code are failing which means there is no value to cas_match and no src for cas_image. When I disable the javascript option, the code displays just fine, except it remains on the page for 2 hours (my caching interval). I’m using PHP version 5.2.6, but I doubt this matters. It seems like an AJAX problem. Thoughts?

November 16, 2008
5:12 pm
Peter
Admin
Forum Posts: 841
Offline

Hi, the "src" and "value" parameters are supposed to be blank, so if you view the source, you won't be able to tell that the JavaScript filled it in. If you access custom_anti_spam.php?antinew (which generates the anti-spam entry) do you get a value? It might be that you have to add that URL to the caching system's "allow" or "ignore" list.

November 17, 2008
1:40 am
openvista
Guest

Yes, I have added that string to my exceptions list. When I type in the direct address to that file (custom_anti_spam.php?antinew) it gives me a number. If I refresh, it increments one. Originally, I was working off a 2.3.3 production site. Now I'm in a development folder with a new 2.6.3 installation. It's just giving me "invalid" as the spam word, whereas on 2.3.3 there was nothing there at all, an unloaded image. Same plugin, same exception rule on the new setup. Although when I disable the plugin everything seems to work fine (Javascript or standard mode).

November 17, 2008
2:00 am
Peter
Admin
Forum Posts: 841
Offline

I really don't know what in WP 2.3 is the cause. As for your WP 2.6.3 install, here are some guesses:

- The antinew URL is outputting more than just the number, confusing the AJAX stuff (try viewing the source on that page to see if there's anything else being output)
- When you're testing the plugin with and without caching, your browser is still giving you its cached page (try a CTRL+F5 refresh or clearing the browser cache and restarting whenever you're testing a different scenario) -- the "invalid" message that you're getting suggests this
- There's something in the caching plugin that you're using that I simply didn't account for (not sure what)
- A client-side issue? I'd have to know your blog URL to be able to test on my browser.

November 17, 2008
11:03 am
openvista
Guest

When the 1 Blog Cacher plugin is off everything works fine. When it's on, I can do a hard refresh and a browser cache clear and I still get an "invalid" message.

Here's a link to an article. Scroll down to the bottom for the comment form. This is in the development area, so feel free to leave a comment, do whatever.

Thanks!

November 17, 2008
12:46 pm
Peter
Admin
Forum Posts: 841
Offline

Update: problem was due to the fact that the AJAX call to the anti-spam entry generator was calling blogroot/?antinew instead of something like blogroot/wp-content/plugins/custom-anti-spam/custom_anti_spam.php?antinew. This is now fixed on his site and in the 3.1.1 release.

November 18, 2008
12:14 pm
openvista
Guest

Peter, I’m having a problem in IE (only checked version 7 so far). When set to javascript display of security code it will appear once but on subsequent visits or refreshes it will display a missing image. I emptied the cache, including cookies. If after refreshing and seeing the missing image, I clear my cache, I can get another code. But refreshing again reproduces the problem. Any ideas?

Here’s a link: test

November 18, 2008
5:43 pm
openvista
Guest

The reason this is an issue is twofold: if someone fills out the comment form wrong, including entering the wrong spam code, the form will prompt them to correct the data. But if the image is missing after they hit the back button, they cannot submit their comment. Also, assuming they filled it out correctly the first time, the form is refreshed upon submitting their comment and visitors cannot leave future comments on that page/post until they clear their cache. Even a hard refresh (cntl-F5) won't pull up a new image. And even if I deactivate the caching plugin, empty cache and refresh twice, the problem is there. Oh and I have verified it is a problem in IE 6 too. FF/Safari work fine.

November 19, 2008
1:13 am
Peter
Admin
Forum Posts: 841
Offline

Looks like a case of good ol' IE caching the request of AJAX calls.

Try re-downloading the plugin and replacing custom_anti_spam.php only. I've added a meaningless timestamp to the dynamic anti-spam entry call to make IE treat each call as unique.