0

I have a problem with a web page using the function getyear(). The page is part of our parent company's website, but I don't have control over it. It is trying to validate an input date by comparing the four-digit year 2014 to checkdate.getyear() which returns 114. Obviously this will never succeed.

The answer I get from the parent company is 'Use IE Version 9 or less'. And under those situations, getyear() returns 2014.

Is there a way to get this javascript to work WITHOUT actually rolling back the browser to IE9? A way to run IE in 'ie9' mode? A way to inject code into the page?

I have very very little javascript knowledge so I'm looking for an easy-to-implement solution.

George W
  • 133
  • 1
  • 2
  • 11
  • 1
    _"but I don't have control over it"_ - Are you saying you can't change the JavaScript in question? If not I don't understand how you think the problem could be fixed. You (they?) should be using [`.getFullYear()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getFullYear). – nnnnnn Apr 05 '14 at 02:09
  • Yes, they should be using .getfullyear(). And yes, I cannot alter the page from the server-side. Further, I am not sure the problem CAN be fixed. But I am asking the question anyway. – George W Apr 05 '14 at 13:39

2 Answers2

0

Try this: http://api.jquery.com/jquery.browser/

This might allow you to put in a if that might just do the work.

EDIT I was wrong as comments pointed out that the method is no more active. I found out a post, a bit more complicated, which might just do the job. Look around.

How can you detect the version of a browser?

Community
  • 1
  • 1
hsim
  • 2,000
  • 6
  • 33
  • 69
  • 1
    Note the "*version deprecated: [1.3](http://api.jquery.com/category/version/1.3/), removed: [1.9](http://api.jquery.com/category/version/1.9/)*" – Jonathan Lonowski Apr 05 '14 at 01:52
0

The javascript function needs to be changed on the front end.

George W
  • 133
  • 1
  • 2
  • 11