Universal AjaxChat and IE

numberkruncher
numberkruncher used Ask the Experts™
on
For some reason IE will not load the "Universal AjaxChat" component correctly. It brings up an error saying that "ajaxChat" and "ajaxChatConfig" are not defined. The component is working perfectly in Chrome and FF.

The script files have src "<script src="http://@mydomain.com/.........">

If I attempt to enter such a script URI into an IE address bar it comes up with an error message stating that this is not a valid URI. If I remove the @ symbol it finds the script. I suspect that this problem is related to the @ in the URI.

Consequentially both Chrome and FF accept URIs with the @ symbol in.

This is a plugin which was installed into Joomla, how do I fix this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This probably relates to the latest IE/8. Which occurs when IE enters Quirks Mode.
http://www.quirksmode.org/css/quirksmode.html

You can ask the pages to display as IE 7 which is more likely what the script was coded for.
<!--[if IE 7]>
   <link rel="stylesheet" type="text/css" href="ie7.css" />
 <![endif]-->

Author

Commented:
It isn't related to QuirksMode because I have tested it as "IE7 Quirks/Standards" and "IE8 Quirks/Standards" and it still doesn't work.

Also, this is not a CSS related issue, the file is literally not being found when then @ symbol is located within a script "src".
can you just leave out the @ symbol from the src, , I do not recognize the purpose of a @ symbol in the web address for a script file, I would think that if you left it out, it would work in Chrome and FF and IE. . .

Author

Commented:
The various PHP files associated with this component use a Joomla function to get the base URI, and it is Joomla that is putting the @ symbol there.

From what I have read, the @ symbol at the start of a URI is used to designate user name, but in this case it is pointless as no user name is specified (and IE does't like it!)

It looks like something to do with the following, removing the line seems to fix the problem, but it feels like a hack because this is obviously supposed to work.
function getChatURL() {
		if(defined('AJAX_CHAT_URL')) {
			return AJAX_CHAT_URL;
		}

		$is_secure = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443;
		return
			($is_secure ? 'https://' : 'http://').
// REMOVED:			(isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
			(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
			($is_secure && $_SERVER['SERVER_PORT'] == 443 || $_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
			substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')+1);
	}

Open in new window

I only offer this as suggestion, I do not have experience in reformulation of a Joomla setup, , but in this "if" statement -
(isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '')
it tests for the $_SERVER['REMOTE_USER'], and then adds the string - "remoteuser@" to the web addy, However, the error seems to be that the variable - $_SERVER['REMOTE_USER'] is set with an empty string so all that is written is the @, but if there is nothing in the $_SERVER['REMOTE_USER'], it is suppose to write Nothing ''
If I were doing this I would not use the isset( ), but would use the PHP empty( )

(empty($_SERVER['REMOTE_USER'])) ? '' : $_SERVER['REMOTE_USER'].'@'

Do you have any way to determine how or if the  $_SERVER['REMOTE_USER']  is set? ? maybe you could just unset it for your particular use here where there is no user name is specified?

You may want to question with the coders at Joomla, since this seems like a mal-function or "bug" in the code?

Author

Commented:
I came to exactly the same conclusion when reading that code. I had actually added the $is_secure variable because its condition was tested in exactly the same form and that too was causing problems.

I will post a message in the Joomla forums and see what people there have to say.

For now at least I have a working solution. I suspect that there are other problems with this particular function.

Thanks,

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial