Advertisement

04.07.2007 at 10:07AM PDT, ID: 22497872
[x]
Attachment Details

AJAX - Javascript in Image Onload Won't Run in Opera in an HTML Response

Asked by cnxmax in Opera Web Browser, JavaScript, WebApplications

Tags: onload, image, opera, javascript, ajax

I'm very new to AJAX and I'm trying to solve a problem that is probably pretty simple...

Sometimes I need a script to run based on a response I get from an HTTP request. I've thought of a lot of ways to do this programmatically by looking at the XML response. However, I've found a very simple way to do this using a regular HTML response.

In my response, I add a single-pixel image that has a randomly generated name (to prevent caching) that looks something like this:

<img src="1x1clear.gif" onload="JavaScriptFunctionINeedToRun();">

This works like a charm in IE 6+, FireFox 1.5+, and Safari. But for some reason Opera doesn't want to do that scrip on load.

So, my question is how can I get this to work in Opera? I'm open to a solution that uses my image idea, but I realize that the image idea may not be the best way so I'm also open to another solution.

Keep in mind, the goal is to make this very easy. I don't really want to have to parse commands out of an XML response or anything like that. The goal is to have a script run based on a regular HTML response that is rendered into my website HTML.

Start Free Trial
[+][-]04.07.2007 at 11:04AM PDT, ID: 18870044

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Opera Web Browser, JavaScript, WebApplications
Tags: onload, image, opera, javascript, ajax
Sign Up Now!
Solution Provided By: stanscott2
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.07.2007 at 11:23AM PDT, ID: 18870082

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32