Safari on Windows/Mac with https

Apr 19, 2012 at 2:59 PM

I am having troubles with a very simple call to SPServices when using Safari (both Windows and Mac).  I am using https and forms based authentication.  Here is the code which works just fine on IE and FF.

Any thoughts on this?  It doesn't give an error message or anything...just stops running the javascript.

$().SPServices({
         operation: "GetListItems",
         listName: "WelcomeText",
         async: false,
         debug: true,
         completefunc: function (xData, Status) {
           alert(xData.responseText);
   $(xData.responseXML).SPFilterNode("z:row").each(function() {
               entityDesc = $(this).attr("ows_Title")
               alert ('Title is: ' + entityDesc);               
          });  // end of each function
       }  // end of completefunc
  });  // end of SPServices

Apr 19, 2012 at 3:07 PM

I think the problem may be with  $(xData.responseXML)... I found the same issue with Chrome which is also (like Safari) a WebKit based browser... Here is more information on how to get the XML in those types of browsers:

http://www.mail-archive.com/jquery-dev@googlegroups.com/msg04964.html

The following should work (but you will have to wrap it in "browser specific code" because I'm not sure now if it also works for IE or FF:

$(xData.documentElement)
Paul

Apr 19, 2012 at 3:59 PM

Paul,

Thanks for the speedy response...

I first tried changing out the $(xData.responseXML) to $(xData.documentElement), see below -- this produced no change in results.

     var entityDesc;  
 $().SPServices({
         operation: "GetListItems",
         listName: "WelcomeText",
         async: true,
         debug: true,
         completefunc: function (xData, Status) {
           alert(xData.responseText);
            $(xData.documentElement).SPFilterNode("z:row").each(function() {
               entityDesc = $(this).attr("ows_Title")
               alert ('Title is: ' + entityDesc);                
          });  // end of each function
       }  // end of completefunc
  });  // end of SPServices

 

Then I even went so far to just test the following and put a document.write after -- notice I commented out all of the XML data manipulation.  When I do this, I don't get the document.write -- which to me means the SPServices is "stopping" mid-stream with some error and preventing the js from continuing. 

     var entityDesc;  
 $().SPServices({
         operation: "GetListItems",
         listName: "WelcomeText",
         async: true,
         debug: true,
         completefunc: function (xData, Status) {
//           alert(xData.responseText);
//            $(xData.documentElement).SPFilterNode("z:row").each(function() {
//               entityDesc = $(this).attr("ows_Title")
//               alert ('Title is: ' + entityDesc);               
//          });  // end of each function
       }  // end of completefunc
  });  // end of SPServices

 document.write ('hello world2');

 

Thanks for any insight you can provide,

Todd
 

Apr 19, 2012 at 4:24 PM

Update:  I created a new site that does not run in HTTPS and everything worked fine on Safari -- with my original code.  There is something goofy going on with https.  I am running SharePoint2007/SP2/IIS7.5 (Server 2008) with FBA.

Thanks for any insight anyone can provide.

Apr 19, 2012 at 7:46 PM

Solution:  on the site, we had the js files on a folder that was not accessible until AFTER you authenticated.  It appears that Chrome and Safari only attempt to get the js file once per session, while IE and FF try on each page refresh.   Once we moved the js files to a folder that had anonymous permissions everything worked.

The first ah-ha moment of what was going on was when we set the login page to automatically login...then everything started working.

Go figure...hope this helps someone else!

Coordinator
Apr 19, 2012 at 9:15 PM

Good catch! So often authentication issues get in the way of calls to the Web Services, and not the actual script.

M.