0

I've been having lots of trouble with a website I'm helping out with. It has a bunch of javasripts to give the website a nice scrolling effect, but it doesn't work on Safari.

So I need a way for the javascripts not to run, preferably by just checking what browser the viewer is using since I've only had this problem with people browsing using Safari. I've never really used javascript before, so I don't know how I can make these exceptions... I'm also curious to why it's just Safari that seems to have this problem as I haven't come across a real concrete answer.

<link rel="stylesheet" type="text/css" href="styles.css" />

<title>Website name</title>
<link rel="shortcut icon" href="_IMG/icon.png" />

<!-- Javascripts causing problems in Safari are commented out for now

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="_JAVA/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="_JAVA/smooth-scroll.js"></script>
<script type="text/javascript" src="_JAVA/skrollr.js"></script>
<script type="text/javascript" src="_JAVA/mainJs.js"></script>
--> 

<link href='http://fonts.googleapis.com/css?family=Buenard:400,700|Bentham' rel='stylesheet' type='text/css'>

  • http://stackoverflow.com/questions/2400935/browser-detection-in-javascript like this? – K K Jun 15 '14 at 13:17

2 Answers2

0

Maybe it is not a Safari problem. Try a more modern browser (@see http://html5test.com/results/desktop.html). If you are using e.g. Firefox or Chrome you can see the developer tools (press F12) for more detailed information. Then you can tell us your error message and we can provide detailed help.

For now it can be: - file not found - local browser access - frameworks are not used correctly - or any other javascript error in mainJS.js (what is ovious a custom file)

And... why do you name the directory for JavaScript "_JAVA"? You don't name you image folder "_EXCEL" as well?

Raxa
  • 354
  • 2
  • 7
0

try this javascript code

if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
// do whatever you want 
}

it might help you with the Safari Browser.