The Jason Salas Experience

Guam's Mr. Media - making people think, making people laugh, pissing people off

Tuesday, May 16, 2006

Ajax problem when leaving "www." out of domain

I'll be posting some technical articles and podcasts I'm developing in the next few days, but a co-worker of mine inadvertently stumbled upon a rather annoying error just now. He navigated to a web app I did using an Ajax remote scripting call without typing "www." in the domain name.

Oddly, MSIE 6.x threw a JavaScript error, saying 'Permission denied'. However, the app as designed works perfectly as long as the predicate is in the URL. Anyone know what/s up with this?

7 Comments:

  • At May 16, 2006 8:55 PM, Blogger Jason Salas said…

    I wonder if it has something to do with the path to the remote script set in the 'URL' argument of XmlHttpRequest.open(). I'm declaring this value as a JavaScript variable of global scope within my library, explicitly specifying the 'WWW.' in my value.

    Maybe this has something to do with it...

     
  • At May 16, 2006 11:32 PM, Anonymous Jeff Lewsi said…

    My guess is SSL. If the cert says www, then you could get an access denied when using HttpXMLRequest.

     
  • At May 17, 2006 7:06 AM, Anonymous Anonymous said…

    Hey Jason,
    I think I stumbled across the same problem your co-worker did when I navigated to http://kuam.com instead of http://www.kuam.com - the tag cloud component errors out on IE with a javascript pop-up error - on Firefox it's a little less obvious, it loads the page with no complaints but of course the tag cloud is empty.

    This is your current implementation:

    var xmlhttp;
    var method = 'GET';
    var url = 'http://www.kuam.com/kuamscripts/js/ajax/getsearchtagcloudkeywords.aspx';

    function getTagCloudSearchItems() {
    createXmlHttpRequest();
    xmlhttp.open(method,url,true);
    xmlhttp.onreadystatechange = handleResponse;
    xmlhttp.send(null);
    }

    Have you tried changing the "url" setting to "/kuamscripts/js/ajax/getsearchtagcloudkeywords.aspx"
    leaving out the "http://www.kuam.com" prefix?

    Let us know what you find..
    Thanks,
    jonah

     
  • At May 17, 2006 7:11 AM, Anonymous jonah said…

    btw you might also want to consider a better abstraction layer when building Ajax components - here's a nice example of one: http://prototype.conio.net/

     
  • At May 17, 2006 10:53 AM, Blogger Jason Salas said…

    Hey Jonah...yeah...changing the URL to a root-relative path did it. Weird - none of the documentation mentions this. I only starting placing the URL argument in a global variable recently, so there's one to grow on. :)

    Thanks for the tip!

     
  • At May 17, 2006 11:21 AM, Anonymous jonah said…

    Jason,
    No problem, nice to hear that worked! I also see you've made good progress with the consistant look and feel for most of your site - just a few pot-holes here and there but I'm sure you'll smoke them out.
    Btw I asked you earlier about becoming a member of your "KUAM.com Beta Tester Community" - What do I need to do to sign up? More eyes on the product before you release it might help perhaps?

     
  • At May 17, 2006 4:42 PM, Blogger Jason Salas said…

    I've already got our Beta Community reviewing a few projects at the moment, but send me your e-mail address to jason @ kuam.com and I'll post your name. I'll also mention them here, so stay subscribed!

     

Post a Comment

Links to this post:

Create a Link

<< Home