Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sugarbabee

macrumors newbie
Original poster
May 12, 2008
13
0
Hi, maybe somebody could help with this problem. My webpage will only work properly in the firefox browser, not safari or opera..I don't have I.E so I dont know about that one. It's in javascript and php, so maybe there's something that only works in firefox or something? sorry I can't give any code out or link the page since its for employees only. The page is to be a page with news articles on it, so people can fill in the title, date, and the article into different fields of a form. There is a dropdown menu with past articles so that if one is selected then the title etc will automatically be filled in. This is only filled in automatically when selected in firefox. Nothing happens in Safari or Opera. Any suggestions would be great, thanks.
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Sounds like a JavaScript issue, i.e. your menu system.

Since you cannot share code or a link the usual advice is determine which part of the JavaScript code isn't cross platform compatible. You should validate the page against W3C suggested guidelines to hope to resolve issues like this, using http://validator.w3.org/ - fix all errors first, examine all warnings and adjust your code, then you could use cool web sites like http://www.browsershots.org to test your page layout across all kinds of browsers even if not test this issue.

I'm going to take a wild guess the JavaScript you're using isn't based on the DOM, meaning a standard set of objects defined by the W3C to standardize code across platforms plus make coding easier and more portable. Probably event trigger related. I am placing no blame on anyone, but some freeware DHTML menus which use JavaScript and other technologies often don't use DOM syntax, don't handle events well and what happened to you is the result.

Just to be clear, evening following the DOM has issues (legacy browsers, different rendering engines each with their own bugs, etc.) but all one can do as a developer is follow a standard and learn through experience what works and doesn't across the major platforms.

I'd offer more specific advice if you could post code, even a snippet. But if you're not, I hope this helps you debug the issue on your own at least.

-jim
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
Not much to go on. I second the above links, check with the validator and also use browsershots to see what other browsers see. Otherwise there's little to nothing we can do for you. The possibilities are very much endless.
 

sugarbabee

macrumors newbie
Original poster
May 12, 2008
13
0
I've tried looking up what commands work in firefox and not anything else...but I couldn't find anything to change.
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
Looks like you're making use of the Prototype JavaScript library since they seem to use that syntax for creating AJAX calls. I don't use Prototype so not sure if it's be implemented here correctly, but nothing sticks out in the code. I don't see anything that would only work in one browser.

I'd probably setup a bunch of alerts in the code to tell me the value of variables at certain areas so I know what is being accessed and what it thinks the values are. Are there any errors coming up in the error console for Safari?
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
I went to their web site and found a page dealing with DOM and browser compatibility, here is a key excerpt:

Because of browsers that don't support this you must take care to use DOM extensions only on elements that have been extended. For instance, the example above [some code] works in Firefox and Opera, but add Element.extend(my_div) after creating the element to make the script really solid

The specific advice is not what I want you to focus on right now. The excerpt hints that there clearly are compatibility issues based on how the framework is implemented. You apparently need to incorporate any tips/advice the Prototype site suggests to improve compatibility!

Note: Due to the extension of the HTML DOM, Prototype JS syntax will fail most JavaScript W3C validators, such as a jslint.com where I ran your code to test for obvious errors before making this reply.

Their web site is here
The excerpt came from this page

I agree with angelwatt, now is the time to use the "error console" features in Opera/Safari to see what JS errors are being generated then check out the Prototype site or Google it to resolve said issues. Any Prototype gurus out there?

-jim
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
Note: Due to the extension of the HTML DOM, Prototype JS syntax will fail most JavaScript W3C validators, such as a jslint.com where I ran your code to test for obvious errors before making this reply.

I always wondered if there was some type of JavaScript validator, though never looked for one. I'm glad you mentioned it. I'll have to see how good it is.
 

sugarbabee

macrumors newbie
Original poster
May 12, 2008
13
0
So the problem now is that I didn't write this code, I'm just supposed to make it work in safari etc, and I don't have aclue what it's even doing with the xhr and Ajax stuff...is there a way to get this to do the same thing without the Ajax stuff? ...Or, could you tell me what it's supposed to be doing? lol I'm fine until it starts doing the function(xhr) and weird looking stuff.
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Ummm...

1. If you know JS in general, and PHP in general, study the API documented on their site I linked for you, plus that page with the excerpt, and start troubleshooting
2. Hire a professional experienced with this product
3. If you have a service agreement with Prototype (assuming they even offer one) contact them for assistance
4. Be prepared to post the entire code and hope gurus out there familiar with that platform can assist in your effort to make the code cross platform compatible (me thinks you don't wanna go this way, nor can you by contract)

Anyone else have any other suggestions?

I consider this a tale of caution because when people start extending the DOM the plus side is you can scale your code, the down side is compatibility issues, validation issues and portability issues. The whole concept of the DOM is to prevent all of that!

-jim

ps: I wish I could personally be of more service but I've never used the API personally. The advice above is intended to be helpful and not hurtful.
 

sugarbabee

macrumors newbie
Original poster
May 12, 2008
13
0
okay well now in the safari web developer I'm getting

ReferenceError: Can't find variable setReleased

and

Can't find variable: deleteProfile ... and it references line 75 which is the line with function deleteProfile(id){

why is it taking the functions as variables?
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
In the error you cited, I see nothing wrong with that line, but the next few lines are extended DOM commands proprietary to Prototype and likely foiled the debugger expecting strict DOM syntax as part of that scope. Just like the JSlint.com validation site didn't like the location of the 'new' keyword because traditionally in JS when creating an object usually the "new" keyword is prefaced by the object name, i.e. myobj = new myMethod(); but the browsers don't seem to mind.

Loose coding syntax combined with extended DOM customization makes debugging somewhat unhelpful!

What you need to do is clear to me -- learn the API, view example code from others, identify differences between your code and theirs, change, then test across browsers.

[EDIT]
BTW on Ajaxian some dude wrote something called ProtoSafe that works with Prototype to resolve third party script compatibility issues known to angry Prototype developers (i.e. mixing JS libraries on one page). Try this helpful page with a link to his project. FYI - I had to bring this in out of good consciousness since your contract denies us access to all of code base. Well, um, that's all I can muster to help ya, God Speed! Take care. :)

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.