AJAX in Safari

I've gotten AJAX to work in Safari by hacking ajax.js. Specifically, replacing this section:


this.style_width = getStyle(div, "width");

this.style_height = getStyle(div, "height");


with this code:


if (this.style_height == '0px') {

this.style_width = '400px';

this.style_height = '26px';



It's a cheap hack, for sure. And it has display issues, in that saving an album title will move the new title down to the next line. I'm not exactly sure why this happens.

The offending code is actually in the getStyle function of ajax.js:


return document.defaultView.getComputedStyle(element, '').getPropertyValue(attribute);


Specifically, document.defaultView.getComputedStyle(element, ''), where element is albumTitleEditable after it has been transformed by (i think) div.getInputField.


  • trisweb Administrator
    Thank you! I've been meaning to take a look at this, but it's very hard without an actual copy of safari on a mac.

    My roomate has a mac though, so maybe I can borrow it to really fix the bugs.
  • I'm not sure that there's an actual proper solution right now.. From what I've read, it's a bug in Safari.

    I fooled around with it a bit and wasn't able to get the height or width of those altered div's using Javascript.. Maybe there's another way than element.style.[width/offsetWidth/clientWidth]?
  • i can't get edits to save when using safari. works fine in firefox. any ideas?
  • What do you mean? Aside from MediaTemple thinking I want to log into my control panel (www.somethingbig.org/admin) when I make edits, I still can.

    I use Safari 2 in 10.4.3 - is that what you've got too?
  • yes, safari 2.0.2 in 10.4.3. i'm using K2 on wordpress and the ajax commenting system works fine there. so i know that safari can send information this way, it just seems that in zenphoto its not saving the new information to the database.

    my site is http://www.wdanielryan.com/photography if you want to check it out.

    i tried turning off K2 as well in case there was a conflict there. same issue.
  • Same problem here with Safari. The titles and descriptions won't save.
Sign In or Register to comment.