Hey Petra!
I copied your code and tried to run it myself in a new site, and it worked for me both in Chrome and Safari. Do you get a specific error? What exactly doesn’t work - does the page not load? does the page load but the gallery doesn’t appear?
Check that the gallery’s id is really “gallery4”. Does everything else work when you comment out the code? Can you recreate the problem on a new site? What version of Safari are you using?
I’ll need more details on what exactly goes wrong and what you’ve tried in order to help you understand what’s not working.
Let me know if any of the above suggestions worked for you,
J.