1

I'd like to leverage a (to me) complicated Javascript, Photoswipe. The author is clear that they don't support IE 7, and although the demo site does function to some degree in IE 7, the instance my team built does not.

Rather than try to modify the script, I'd like to use something like Yep/Nope to detect which Javascript feature is failing and provide a simpler alternate gallery that I know works well in old browsers. I'm trying to avoid user-agent sniffing.

Is there a tool or method available to sort out what to feature-detect against in a script that you don't know the ins-outs of personally?

Sam Hanley
  • 4,707
  • 7
  • 35
  • 63

1 Answers1

0

Why not simply use the IE conditionals to load the alternate gallery?

<!--[if IE 7]>
    <script src="alternate.js"></script>
    <script>var ie7 = true;</script>
<![endif]-->
<script src="normal.js"></script>

then mod the normal.js to check for that ie7 flag and skip loading the code if it's set.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • This is good practical advice, it neatly solves the problem for IE7.. but in another sense it's almost like user-agent sniffing in that it doesn't solve the issue for other browsers that don't support X feature. I might end up doing this if feature detection proves too complicated. – Nate Steiner Jun 22 '12 at 15:20
  • True, but it's pretty reliable agent sniffing, since it'll only really work in IE. – Marc B Jun 22 '12 at 15:23