Problem With Script Execution In Safari
I had a problem with some functionality working in all browsers except for Safari, and I have reduced the problem down to this. In my page I have the following script declarations
Solution 1:
Your code seems good.
I tried with this code
<!DOCTYPE html><html><head><title>Test</title></head><body><h1>Test</h1><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"type="text/javascript"></script><scripttype="text/javascript">
$(function () {
alert("Test");
});
</script></body></html>
and it works fine (Safari 5.0.5 7533.21.1 on Windows 7).
A couple of questions:
- Have you tried calling your function manually from the Error Console? Does it work?
- If you place a simple
alert("Test.");
outside of the document ready function, is it displayed? - If you call jQuery's function from the Error Console, what do you get? Do they work?
Solution 2:
The problem was found elsewhere in mainScript.js
.
{ class: 'someclass' }
was sent as parameter to some method, and class is a reserved word.
This should probably have given errors in other browsers as well, but they gladly ignored it and kept on going.
The fix was simply to change it to { 'class': 'someclass' }
Post a Comment for "Problem With Script Execution In Safari"