views:

21

answers:

1

I want to change the settings of firefox so as to allow it to make cross domain ajax calls. Since due to the security feature of the firefox it doen't allow ajax calls to be made. I know if it is in same domain it will allow. I have a code given bellow which in safari works fine but firefox doesn't display the results when it calls csce server then since the code is on local machine doesn't allow it and returns error. I know it will start working if I load my this code to csce server but I want to run the code from my machine. So can anyone help me in resolving this. I have spent past couple of days just searching for this solution.

Kindly suggest how to achieve this or should I go with some older version of firefox?

The code is as follow:

<html><head></head>

<body>
<button type="button" onClick="handleButtonClick();">undo</button>
<button type="button">redo</button>
<select><option value="V1">V1</option>
<option value="V2">V2</option>
<option value="V3">V3</option>
<option value="V4">V4</option>
<option value="V5">V5</option></select>  

<script type="text/javascript">
function handleButtonClick(){var xmlHttp, handleRequestStateChange; 
handleRequestStateChange = function() {if (xmlHttp.readyState==4 && xmlHttp.status==200)    {    var substring=xmlHttp.responseText; alert(substring); } }      

xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "http://csce.unl.edu:8080/test/index.jsp?id=c6c684d9cc99476a7e7e853d77540ceb", true);   
xmlHttp.onreadystatechange = handleRequestStateChange; xmlHttp.send(null);}
</script>

</body>

I googled and set the parameters of browser in config file as specified in this site but it still doesn't work.

http://code.google.com/p/httpfox/issues/detail?id=20

+1  A: 

Maybe you could use privoxy and tell it to inject something like "Access-Control-Allow-Origin: *" in the server response. To do this, you would have to go into the file user.filter (create it if it doesn't exist) in privoxys configuration directory and insert something like this:

SERVER-HEADER-FILTER: allow-crossdomain
s|Server: .*|Access-Control-Allow-Origin: *|

Instead of Server, you can also use any other header that's always present and you don't need. And this into user.action:

{+server-header-filter{allow-crossdomain}}
csce.unl.edu

Note: I didn't test it.

https://developer.mozilla.org/En/HTTP_access_control

http://config.privoxy.org/user-manual/

thejh
Can you little bit elaborate "could use privoxy and tell it to inject"
Judy