Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
I tried it, but now Internet Explorer won't show a thing, it doesn't load anything. The script is in the right place, just IE doesn't show anything at all - no post, no time, no recognition that it even exists.

With IE it will sometimes show an error for JavaScript issues. If I remember correctly a yellow triangle will show up at the left side of the status bar. This will bring up any errors. See if IE is giving any explicit error messages that may help shed some light on this. I'm just making guesses at this point.
 
With IE it will sometimes show an error for JavaScript issues. If I remember correctly a yellow triangle will show up at the left side of the status bar. This will bring up any errors. See if IE is giving any explicit error messages that may help shed some light on this. I'm just making guesses at this point.

The only thing that came up was the eye with the cancel sign, it deals with cookies.

It comes up:
Privacy Policy said:
Could not find a privacy policy for http://twitter.com/statuses/user_timeline/bbbtest.json To view this sites privacy policy, contact the Web site directly.

I then clicked it, and tried two different options:
Never allow this site to use cookies
Always allow this site to use cookies

Neither of which worked.
 
Have a look here and see if it's of any use to you.

Not really, but it did lead me to CushyCMS and how to make the page load quicker, thanks!

I want to a custom timestamp to appear, instead of the standard '2 hours ago' tag.

And it works perfectly, except for in Internet Explorer for some reason...
 
I've stripped it down just to this, for the Month, Date, Year format:

PHP:
function relative_time(time_value) { 
  var parsed_date = new Date(); 
  parsed_date.setTime(Date.parse(time_value)); 
  var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 
    'September', 'October', 'November', 'December');
  var m = parseInt(parsed_date.getMonth()); 
  var postedAt = ''; 
  // construct date string 
  postedAt += months[m]; 
  postedAt += " "+ parsed_date.getDate(); 
  postedAt += ", "+ parsed_date.getFullYear(); 
  return postedAt; 
}

I tried adding/changing it a bit to:

PHP:
  var d = parseInt(parsed_date.getDate()); 
  var y = parseInt(parsed_date.getFullYear()); 
  
  ...
  
  postedAt += " "+ d; 
  postedAt += ", "+ y;

I was trying to force the Not a Number error from IE like you did, but it didn't work.

I'm no expert at javascript, but I'm guessing IE has a problem handling the parsed_date value. Everything relates back to it which is causing a problem. The
PHP:
postedAt += months[m];
returns as undefined because the
PHP:
var m = parseInt(parsed_date.getMonth());
returns as NaN just like the other two:
PHP:
  postedAt += " "+ parsed_date.getDate(); 
  postedAt += ", "+ parsed_date.getFullYear();

Since then I've managed to find the line that IE is having a problem with:
PHP:
parsed_date.setTime(Date.parse(time_value));

That's all I got. :eek:

Any idea how to fix it?
 
Can you find out what the value of "time_value" is when it gets to that function? You can do a,
PHP:
alert('"'+ time_value +'"'); // quotes added to see if any spaces exist at beginning or end of string
If we have that info we can try some things out probably.
 
Can you find out what the value of "time_value" is when it gets to that function? You can do a,
PHP:
alert('"'+ time_value +'"'); // quotes added to see if any spaces exist at beginning or end of string
If we have that info we can try some things out probably.

I get an alert for each of the Twitter updates that looks like this:

Javascript
"Sun Aug 03 18:06:03 +0000 2008"
 
I get an alert for each of the Twitter updates that looks like this:

Javascript
"Sun Aug 03 18:06:03 +0000 2008"

Ah, ha now that helped. Twitter uses a stupid date format, so we'll fix that. Add the following line at the top of the function:
PHP:
time_value = time_value.replace(/ \+[\d]{4}/, "");
My good ole friend regular expression comes to the rescue. The above will strip out the +0000 portion of the string, which you weren't using anyways. IE is then able to parse it with the date function. Let me know if that fixes things for you. I tested in IE6/7.

Edit: Crap it removed the back slashes. Add a backslash (the one above enter, not the one on the ? key) in front of the plus and the 'd' parts.
 
Ah, ha now that helped. Twitter uses a stupid date format, so we'll fix that. Add the following line at the top of the function:
PHP:
time_value = time_value.replace(/ \+[\d]{4}/, "");
My good ole friend regular expression comes to the rescue. The above will strip out the +0000 portion of the string, which you weren't using anyways. IE is then able to parse it with the date function. Let me know if that fixes things for you. I tested in IE6/7.

Edit: Crap it removed the back slashes. Add a backslash (the one above enter, not the one on the ? key) in front of the plus and the 'd' parts.

It works! I tested in IE 7 and it works.

Thanks, I really would have never solved it, nevermind all the other stuff. :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.