Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Closed Thread
  Search this Thread
Old 03-18-2010, 12:48 PM   #1
LQ Newbie
Registered: Feb 2010
Posts: 16

Rep: Reputation: 0
Extension Server communication

How can an extension communicate with a server?
how do they exchange data?
suppose u sign in to a page, how does the connection between th
extension and server be after sign in?
how does the server send a message to one of these signed in clients?

i tried the communication part in ajax httprequest response
objects...the javascript n php are communicating...but wen i
integrated the code into the extension, it din give output.
i heard that ajax wont work well in the backend in xul
applications..something about xml there any other way for
carrying out this extension server communication...

a Mozilla Firefox extension which connects two or more people located
at geographically distant areas, who happen to be browsing the same
website simultaneously. It shows you other people who visit the same
websites as you are.

The extension informs the server whenever the user clicks the
EnableChat button to start a chat session.
The server retrieves from its database, the list of users who are
currently online in that site and returns it.
The user can then click on any username for opening a chat session.
this is my xul file:

<?xml version="1.0"?>
<overlay id="blaze-overlay"
<script language="javascript" type="text/javascript" src="chrome://
blaze/content/connect.js" />
<toolbox id="navigator-toolbox">
<toolbar id="blaze-toolbar" align="center" toolbarname="blaze"
accesskey="B" class="chromeclass-toolbar" context="toolbar-context-
menu" hidden="false" persist="hidden">
<label control="some-text" value="Username"/>
<textbox id="some-text"/>
<label control="some-password" value="Password" />
<textbox id="Userpassword" type="password" maxlength="15"
onkeypress="if(event.keyCode == 13)
<toolbarbutton id="blaze-button" tooltiptext="Click for chat with
other users"
label="Enable Chat" oncommand="getUsers('');" />
<toolbarbutton id="blaze-logout" tooltiptext="Click to log out of
BLAZE" label="Logout" oncommand="alert('bye!')" />
<statusbar id="status-bar">
<statusbarpanel id="my-panel" label="Hello, World" />


var xmlhttp;
function getUsers(u)
xmlhttp=new XMLHttpRequest();
var url="servercode.php?q="+u;
xmlhttp.onreadystatechange= useHttpResponse;"GET",url,true);

function useHttpResponse()
if (xmlhttp.readyState==4 )


var xml;
function verifyusernamepasswd()
var usernamebox=document.getElementById("some-text");
var passwordbox = document.getElementById("Userpassword");
var username=usernamebox.value;
var password=passwordbox.value;
xml=new XMLHttpRequest();
var url="loginvalidate.php";
var param="q="+username+"&p="+password;"POST",url,true);
xml.setRequestHeader("Content-type", "application/x-www-form-
xml.setRequestHeader("Content-length", param.length);
xml.setRequestHeader("Connection", "close");

function statechanged1()
if(xml.readyState==4 && xml.status==200)


{die('could not connect to database'.mysql.error());

mysql_select_db("BLAZE",$con) or die("No such Db");
$result=mysql_query("SELECT * FROM USERURL WHERE url=''");
if($result == null)
echo 'halla';
header('Content-type: text/html');
echo '{Users:[';

echo "]}";


$con = mysql_connect("localhost","root","blaze");
if (!$con)
die('Could not connect: ' . mysql_error());

var $false="false";
var $true="true";
$result=mysql_query("SELECT Userid,Password FROM USERTABLE WHERE
echo $false;
echo $false;

echo $true;

my problem is that i cant get the response of the php to the
extension. there is proper connection between my javascript n
php...for eg, i ran the javascript in html in /var/wwww here server
code is n i got output. but wen i integrated it with the extension, i
din get the response from php to the extension...
what could possibly be wrong????????

Last edited by Neethusha; 03-18-2010 at 12:49 PM.
Old 03-18-2010, 06:38 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Closed Thread

coming, presentation, project

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox Extension: about communication with the server Neethusha Programming 4 03-18-2010 10:22 PM
Server Client communication Kakarot_Rathish Programming 7 01-09-2009 06:40 PM
Fault in KDE processes communication: Could not read network communication list Magnus Johansson MEPIS 0 03-30-2008 01:50 PM
server/browser communication calorie712 Programming 1 03-16-2006 06:24 PM
communication across a proxy server sureshk Linux - Networking 0 10-09-2003 02:12 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration