Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compliance Issues with Opera

Status
Not open for further replies.

prgmrgirl

Programmer
Feb 12, 2004
119
US
Hey guys,
I'm trying to test a webpage on Opera. It works fine in IE and Firefox. I pared down all the javascript trying to isolate the problem but nothing helps.

The details:
Testing the page on a machine running XP Pro. I'm using an aspx file on localhost and running the page by right-clicking and Open With -> Opera.

What happens?
JavaScript - file://localhost/folder/pathtohtmlfile.htm
Event thread: click
Error:
Unhandled exception: [Object JavaObject]

The abbreviated html:
<input type=button value="Press the Button" id="btnTest" onclick="getProducts();"/>

The abbreviated javascript:
Code:
function createRequest()
{

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function getProducts()
{
	request = createRequest();
	if (request==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 

	request.onreadystatechange=stateChanged;
		if (typeof netscape != 'undefined' && typeof netscape.security !='undefined') 
		{
			netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
		}
	request.open("GET",url,true);
	request.send(null);

}

function stateChanged()
{
	if (request.readyState==4)
	{ 
		alert(request.responseText);
	}

}

Can anyone see what I am missing here? The error I get from Opera is not helpful at all...

Thanks guys!
prgmrgirl

 
- At what stage do you get the error?

- Which version of Opera are you testing it wit? (have you tried the latest version?)

- Do you have a URL to the full page? If so, can you provide steps to reproduce the error?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hey Dan (that's one of my favorite songs btw [tongue] ),

- At what stage do you get the error?
As soon as I click the button that runs the javascript.

- Which version of Opera are you testing it with? (have you tried the latest version?)
Latest version

- Do you have a URL to the full page? If so, can you provide steps to reproduce the error?
It calls an aspx page on localhost so its not a page you can use. However, I know the aspx page is good because it works without a hitch on IE and Firefox.

Basically what its doing is getting a string value from an aspx page (using ajax) and displays it in an alert.

So, Feherke, to answer your question:
url =
If you substitute that page with some aspx on localhost that simply returns a string, it should work in firefox and IE.

I suspect that the fact that it is accessing a page on localhost might be the problem. I had to do a small work around to get it to work in Firefox because it was complaining that it didn't have rights to open the page.

I wonder if Opera requires some sort of security setting to be set or something. I find it odd that its not really giving me an error. This is what it says in the error console:
Code:
JavaScript - file://localhost/folder/pathtohtmlfile.htm
Event thread: click
Error:Unhandled exception: [Object JavaObject]

When I run it in netscape, I don't get an error at all but neither does it return a value. [sadeyes]

It's all very strange. Why does it have to be so difficult to make this stuff cross-browser??
 
Ah - that could be the hint we need... you are using the file:// protocol. AJAX wants to use http:// for it's URLs. So you need to make sure the intial file and any file accessed through AJAX is on the dame domain, using the same protocol, and using http:// (or
See if merely putting everything onto a proper web server fixes your problems.

Cheers,
Jeff


[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top