Author Topic: fix for AJAX updates with IE8 and green-flash  (Read 15211 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
fix for AJAX updates with IE8 and green-flash
« on: March 20, 2009, 11:48:38 AM »
Grrr...

They didn't 'fix' their 'improvement' to IE, so I guess we have to fix all our scripts to adapt.

in ajaxWDwx.js (Weather-Display AJAX) or ajaxVWSwxf.js (VWS AJAX), replace
Code: [Select]
var ie4=document.all;
var browser = navigator.appName;
with
Code: [Select]
var ie4=document.all;
var browser = navigator.appName;
var ie8 = false;
if (ie4 && /MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8) {
   ie4=false;
   ie8=true;
 }
}

Then replace
Code: [Select]
function get_ajax_tags ( ) {
// search all the span tags and return the list with class="ajax" in it
//
  if (ie4 && browser != "Opera") {
  with
Code: [Select]
function get_ajax_tags ( ) {
// search all the span tags and return the list with class="ajax" in it
//
  if (ie4 && browser != "Opera" && ! ie8) {
and the 'green flash' for updates will behave in IE8 in either regular or compatibility mode (and still play nice with the other browsers).

EDIT: found one more twitch to fix with IE8 and ajax for the get_ajax_tags() routine, and slight update to the prior post.

Best regards,
Ken
« Last Edit: March 20, 2009, 02:44:20 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline BfdWx

  • WxElement panel
  • Senior Contributor
  • *****
  • Posts: 255
    • Branford Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #1 on: March 20, 2009, 12:03:10 PM »
Haha! I knew you would be able to fix this Ken, you should send Mr. Gates a bill!

Thanks for doing this.

Regards,

Jack

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: fix for AJAX updates with IE8 and green-flash
« Reply #2 on: March 20, 2009, 02:45:42 PM »
Bump..
I found another twitch with IE8 and the get_ajax_tags() function that also needed change.
Updated the first post with the corrections.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #3 on: March 20, 2009, 10:29:31 PM »
Thanks Ken.   :grin:

Now for the silly questin as I seem to be missing something.. ;)

What is it I'm actually fixing when I change the code?  I had not noticed any problems.  But I'm still running IE7 and predominately FF 3.0.7.
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: fix for AJAX updates with IE8 and green-flash
« Reply #4 on: March 20, 2009, 10:57:06 PM »
With IE Version 8 in 'native' mode, the AJAX update would turn green and stay green (no more 'green-flash' indicating an update).  You only see the effect with IE8 in native mode.. in compatibility mode it works just the same as IE7.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #5 on: March 21, 2009, 12:26:31 AM »
Uh-oh, I updated to IE 8 after changing the code to test the rest of my pages and I still get the freeze on the color flash.  Other then that I see some minor page alignment issues on a couple of pages but no biggies to repair so far.

(FYI, I'm using red as my flash color.)  I double checked and the new code is loaded to the ajaxVWSwxf.js file on my website.

http://fairfieldcountyweather.com/ajaxVWSwxf.js

Interesting how you can easily view the text of the file at the link above using FF but IE wants to download or open the file.
« Last Edit: March 21, 2009, 12:30:32 AM by Mark / Ohio »
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 249
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: fix for AJAX updates with IE8 and green-flash
« Reply #6 on: March 21, 2009, 12:44:55 AM »
Ken,

Thanks for the heads up, looks like a easy fix  :-) , so I guess  #-o I will have to update the code soon to see if it works, accept I not using IE 8 yet  :roll: , hope Mr Gates pays :roll: you for this fix

Jeanette
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: fix for AJAX updates with IE8 and green-flash
« Reply #7 on: March 21, 2009, 02:02:04 AM »
Uh-oh, I updated to IE 8 after changing the code to test the rest of my pages and I still get the freeze on the color flash.  Other then that I see some minor page alignment issues on a couple of pages but no biggies to repair so far.

(FYI, I'm using red as my flash color.)  I double checked and the new code is loaded to the ajaxVWSwxf.js file on my website.

http://fairfieldcountyweather.com/ajaxVWSwxf.js

Interesting how you can easily view the text of the file at the link above using FF but IE wants to download or open the file.
Ok, that is strange Mark.  It looks like the mod is correct, but... it never 'un-flashes' in IE8 native.

My test page http://saratoga-weather.org/AJAX/VWS/VWS_ajax_demo.htm has the mod installed on the ajaxVWSwxf.js script, and it's working fine in IE8.

Maybe it's due to differences in IE8-native processing of your page.  Firefox and IE7 are more forgiving of HTML errata and try to do what you want with inccomplete info (FF is much better at that).  I ran your homepage through the
W3 Validator and it highlighted multiple errors.  One that may be confusing it is the multiple occurrences of
<span class="ajax" id="ajaxtime"></span> .. you can only have one occurrence of a particular id='...' per HTML page, so maybe the script is getting lost trying to find all the class="ajax" entries ?!?

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #8 on: March 22, 2009, 12:39:35 AM »
.. I ran your homepage through the W3 Validator and it highlighted multiple errors....

That's putting it politely.   :lol:  97 Errors and 32 Warnings more precisely.  Been several years since I last run any of my pages through the W3C validator.

I removed the extra ajax time from the code but still have the color frozen.  I don't find any other duplicate ajax id's.  (Still not sure how it was working with two of them there and only showing one.)  Apparently I was editing and missed that at some point.  I only use them for the current conditions, never spent the time yet to update the rest of the page to ajax as you probably seen by the source.

Oh well, as I get time I'll try to whittle out some of the other 97 errors and see if that helps any.  I've had some issues with colors showing incorrectly in different browsers involving the drop down menu and perhaps it's all related.  I have a bit of a love hate relationship with the drop down menu anyway.  I like it's appearance but hate the extra up keep and code it requires to operate or make changes to it.
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 249
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: fix for AJAX updates with IE8 and green-flash
« Reply #9 on: March 23, 2009, 04:17:15 AM »
UPDATE: :-)

I have now updated the code for AjaxWDwx.js  :-) for IE8, Everythings still running fine in FF and IE7, since I am not yet running IE 8 on my computer I would appreciate feedback that the fix worked and that the page is running fine in IE8

Thanks,
            Jeanette
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline kray1000

  • Purveyor of wry
  • Forecaster
  • *****
  • Posts: 1336
    • http://www.roanokevalleyweather.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #10 on: March 23, 2009, 06:53:14 PM »
Since I am not yet running IE 8 on my computer I would appreciate feedback that the fix worked and that the page is running fine in IE8

If anyone wants to check mine as well, I'd appreciate it.

Offline Mark / Ohio

  • Live from Mars!
  • Forecaster
  • *****
  • Posts: 2511
    • Fairfield County Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #11 on: March 23, 2009, 11:02:41 PM »
Jeanette...  Looks good, your flashing green.   ;)


Kevin...  Back to the drawing board, your still stuck green.  (And if you figure it out let me know so I can try your fix on my page.  :roll: )

I did not find any other problems on either of your pages with IE8
« Last Edit: March 23, 2009, 11:07:21 PM by Mark / Ohio »
Mark 
2002 Davis VP I Wireless, WeatherLink (Serial), GRLevel3, VirtualVP, StartWatch, Weather Display, Windows 10


Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: fix for AJAX updates with IE8 and green-flash
« Reply #12 on: March 24, 2009, 03:32:51 AM »
Any changes in ajaxVWSgizmo.js to make it work in IE8?
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline kray1000

  • Purveyor of wry
  • Forecaster
  • *****
  • Posts: 1336
    • http://www.roanokevalleyweather.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #13 on: March 24, 2009, 06:59:59 AM »
Kevin...  Back to the drawing board, your still stuck green.  (And if you figure it out let me know so I can try your fix on my page.  :roll: )

Thanks, Mark.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: fix for AJAX updates with IE8 and green-flash
« Reply #14 on: March 24, 2009, 02:30:14 PM »
Any changes in ajaxVWSgizmo.js to make it work in IE8?
Yes, pretty much the same as for ajaxVWSwxf.js .. for ajaxVWSgizmo.js, change
Code: [Select]
var ie4=document.all;
//var ie4 = 0;
to
Code: [Select]
var ie4=document.all;
var browser = navigator.appName;
var ie8 = false;
if (ie4 && /MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8) {
   ie4=false;
   ie8=true;
 }
}
and
Code: [Select]
  if (ie4 && browser != "Opera") {
to
Code: [Select]
  if (ie4 && browser != "Opera" && ! ie8) {
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: fix for AJAX updates with IE8 and green-flash
« Reply #15 on: March 24, 2009, 04:06:33 PM »
Thanks Ken

Now it's working again  =D&gt; \:D/
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline WeatherAnomaly

  • Senior Member
  • **
  • Posts: 56
    • Pinellas Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #16 on: March 25, 2009, 09:42:51 AM »
Reading through the thread....so is the root cause MS IE8,  PHP (version? 4 or 5) or is it AJAX coding? If it is MS I'll submit a case to them via Premier Support and notify my TAM.
-The National Weather Service is one of the "few" US Government operations (US Department of Commerce) that give every American a "tangible benefit" for their tax dollar.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: fix for AJAX updates with IE8 and green-flash
« Reply #17 on: March 25, 2009, 12:42:10 PM »
The root cause is the change in IE8's native behavior to be like Mozilla/Safari/Opera .. it breaks many older JavaScripts which have code to detect IE and 'do things the IE way' instead of doing it the way the other browsers have developed.

So it's a 'good' thing that MS finally is going with the industry for JavaScript, it's a bad thing for JavaScript coders who now have to support IE8 native and all the quirky IE's in the past (5.5, 6, 7 ) and the Mozilla/Safari/Opera crowd.  Fortunately,
IE8 native seems to have the same kinds of JavaScript interfaces that Mozilla/Safari/Opera do, so it's just a matter of adding detection for IE8+ and handling it as 'non-IE' in the script .. that's what I did with the fixes for the AJAX routines.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline kray1000

  • Purveyor of wry
  • Forecaster
  • *****
  • Posts: 1336
    • http://www.roanokevalleyweather.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #18 on: March 25, 2009, 04:52:10 PM »
There's something about IE8 that's a little different, though.  My ajax updates work in IE7, Firefox, (Windows) Safari, and Opera but not in IE8, even after applying the fixes.
« Last Edit: March 25, 2009, 04:53:56 PM by kray1000 »

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #19 on: March 25, 2009, 06:13:02 PM »

Likewise, would someone who's using IE8 please kindly check mine?

     http://www.wxbeacon.com/vws/current.php

Thanks!

Kevin...
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline BfdWx

  • WxElement panel
  • Senior Contributor
  • *****
  • Posts: 255
    • Branford Weather
Re: fix for AJAX updates with IE8 and green-flash
« Reply #20 on: March 25, 2009, 06:24:03 PM »
Hi Kevin,

Just checked for you but it stays "red".

Jack

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #21 on: March 25, 2009, 06:28:05 PM »
Hi Kevin,

Just checked for you but it stays "red".

Jack


Huh. Okay, thanks for checking it, Jack!

I had made the above recommended changes, so I must be having the same problem KRAY is seeing.

Kevin...
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: fix for AJAX updates with IE8 and green-flash
« Reply #22 on: March 26, 2009, 12:50:13 AM »
Hmmm... the only common script (besides an AJAX script) I see on both Kevins sites is the boxover.js script.  Would one (or both) Kevin's mind making a copy of their page to a new page and omit the boxover.js script call and see if that fixes the IE8 flash issue?

Both of your AJAX scripts were modified correctly to detect and process when IE8 native-mode is found.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline kray1000

  • Purveyor of wry
  • Forecaster
  • *****
  • Posts: 1336
    • http://www.roanokevalleyweather.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #23 on: March 26, 2009, 06:42:24 AM »
I'll try that this evening when I have more time.

Mark is also having this issue.  Not sure if he has the boxover script though.
« Last Edit: March 26, 2009, 06:44:34 AM by kray1000 »

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: fix for AJAX updates with IE8 and green-flash
« Reply #24 on: March 26, 2009, 09:05:38 AM »


Hmmm... the only common script (besides an AJAX script) I see on both Kevins sites is the boxover.js script.  Would one (or both) Kevin's mind making a copy of their page to a new page and omit the boxover.js script call and see if that fixes the IE8 flash issue?

Both of your AJAX scripts were modified correctly to detect and process when IE8 native-mode is found.

Best regards,
Ken

Here you go, Ken. I've made a copy of my current.php page but removed the boxover:

     http://www.wxbeacon.com/vws/AAAcurrent.php

Thanks for taking a look at it!

(Hah! So both Kevin and I happen to be using the same boxover script? Funny!)

Kevin...
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3