Results 1 to 3 of 3

Thread: IE8 reports an error

  1. #1
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face IE8 reports an error

    1) Script Title: METS.Widget({id: 'MSwidgetOne',

    2) Script URL (on DD): www.hawkesbay.co.nz

    3) Describe problem: Every time my homepage loads with Internet Explorer 8 the following message is displayed, bottom right, in the Task Bar
    "unidentified" is nul or not an object
    ms.widgit.js Line 179
    Code 0 Char 28
    HRI: http//www.metservice.com/assets/js/ms.widgit.js

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BTRS124447; GTB7.4; EasyBits GO v1.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; Alexa Toolbar)
    Timestamp: Tue, 4 Sep 2012 01:04:55 UTC


    Message: 'undefined' is null or not an object
    Line: 179
    Char: 28
    Code: 0
    URI: http://www.metservice.com/assets/js/ms.widget.js

    The script I am using is as follows:

    Code:
    <center><script type="text/javascript" src="http://www.metservice.com/assets/js/ms.widget.js"><!--/************************************************ Dynamic Countdown script- Dynamic Drive(http://www.dynamicdrive.com)* This notice MUST stay intact forlegal use* Visit http://www.dynamicdrive.com/ for this script and 100s more.***********************************************/// --></script><script type="text/javascript"><!--newMETS.Widget({id: 'MSwidgetOne',host: 'www.metservice.com',city: 'Hastings',type: 'two'});newMETS.Widget({id: 'MSwidgetTwo',host: 'www.metservice.com',city: 'Napier',type: 'two'});// --></script><div class="cleanslate MSwidget" id="MSwidgetOne"></div><div class="cleanslate MSwidget" id="MSwidgetTwo"></div></center>
    Many thanks

    Max
    Last edited by jscheuer1; 09-04-2012 at 03:24 AM. Reason: Format

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's not actually a DD script. It's a weather widget from MetService. They do use some DD code though, so the credit should remain. The error occurs in the http://www.metservice.com/assets/js/ms.widget.js file on the line specified (179) as it's trying to convert an undefined object/variable to upper case.

    This error occurs in other browsers (IE 9, Opera, Chrome, probably others). IE 8 is just more aggressive in reporting it. The widgets are working in IE 8 and those others. They are the weather reports for Hastings and Napier.

    The problem arises because mootools (which is also used on the page) isn't 100% compatible with the mets weather widget. Because of the error, even in those browsers which render the widget, you lose the orange "Warnings in force" link bar of the widgets.

    You could put the widget on a separate page and have it shown on the main page via an iframe, you would lose the error, get back the "Warnings in force", but the disclaimer would not display properly (that can be worked out though). Of course you could get rid of mootools from the page, but that seems unlikely.

    For iframe, put this in the head of the page (highlighted as indicated):

    Code:
     . . .			right: 10px;
    			z-index: 15;
    			display: none;
    		}
    		
        -->
      </style>
    <link rel="stylesheet" href="http://www.metservice.com/assets/css/MSwidget.css" type="text/css">
    <style type="text/css">
    .MSdisclaimerContainer {
    	width: 500px !important;
    }
    .MSdisclaimerContainer .MSdisclaimerInner {
    	border-radius: 15px !important;
    }
    </style>
      <script type="text/javascript" src="/media/system/js/mootools.js"></script>
      <script type="text/javascript" src="/plugins/system/jceutili . . .
    On the page in the body replace:

    Code:
    					<center>
    <script type="text/javascript" src="http://www.metservice.com/assets/js/ms.widget.js"><!--
    /***********************************************
    
    * Dynamic Countdown script- Dynamic Drive
    
    (http://www.dynamicdrive.com)
    * This notice MUST stay intact for
    
    legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    
    ***********************************************/
    // --></script>
    <script type="text/javascript"><!--
    new
    
    METS.Widget({id: 'MSwidgetOne',
    host: 'www.metservice.com',
    city: 'Hastings',
    type: 'two'});
    new
    
    METS.Widget({id: 'MSwidgetTwo',
    host: 'www.metservice.com',
    city: 'Napier',
    type: 'two'});
    // --></script>
    <div class="cleanslate MSwidget" id="MSwidgetOne"></div>
    <div class="cleanslate MSwidget" id="MSwidgetTwo"></div>
    </center>
    with:

    Code:
    <script type="text/javascript">
    (function(){
    	function onloadfunc(){
    		document.getElementById('metsframe').src = 'mets.htm';
    	}
    	if (window.addEventListener){
    		window.addEventListener('load', onloadfunc, false);
    	}
    	else if (window.attachEvent){
    		window.attachEvent('onload', onloadfunc);
    	}
    })();
    </script>
    <iframe id="metsframe" src="about:blank" style="width: 238px; height: 262px; border-width: 0; overflow: hidden; margin: 0 auto; display: block;" frameborder="0"></iframe>
    Create mets.htm in the same folder and put this code in it:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Met Service Westher Widget</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    html, body {
    	margin: 0;
    	padding: 0;
    	overflow: hidden;
    }
    </style>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
    <script type="text/javascript">
    if(self !== parent){
    	jQuery.fn.jquery = '1.5.1';
    	var $ = jQuery.noConflict(true), pds, timer;
    	$('head').append('<style type="text/css">.MSdisclaimerContainer {display: none !important;}<\/style>');
    	$('.MSdisclaimer').live('mouseenter', function(e){
    		clearTimeout(timer);
    		if(pds){pds.remove();}
    		var $ds =$(this), w = $ds.width(), h = $ds.height(), o = $ds.offset(), po = $(parent.document.body).find('#metsframe').offset();
    		pds = $('.MSdisclaimerContainer').clone(true).css({display: 'none', position: 'absolute', top: o.top + po.top + h, left: o.left + po.left + w, width: 238, height: 'auto'});
    		$(parent.document.body).append(pds);
    		pds.fadeIn('slow');
    		pds.unbind().hover(function(){clearTimeout(timer);}, function(){timer = setTimeout(function(){pds.remove();}, 1000);});
    	}).live('mouseleave', function(){
    		timer = setTimeout(function(){pds.remove();}, 1000);
    	});
    }
    </script>
    </head>
    <body>
    <script type="text/javascript" src="http://www.metservice.com/assets/js/ms.widget.js">
    // ms.widget.js contains and sometimes uses:
    /***********************************************
    * Step Carousel Viewer script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/
    </script>
    <script type="text/javascript">
    new METS.Widget({id: 'MSwidgetOne',
    host: 'www.metservice.com',
    city: 'Hastings',
    type: 'two'});
    new METS.Widget({id: 'MSwidgetTwo',
    host: 'www.metservice.com',
    city: 'Napier',
    type: 'two'});
    </script>
    <div class="cleanslate MSwidget" id="MSwidgetOne"></div>
    <div class="cleanslate MSwidget" id="MSwidgetTwo"></div>
    </body>
    </html>
    Some tweaking may be required/desired. The browser cache may need to be cleared and/or the page refreshed to see changes.

    One other solution would be to suppress error reporting:

    Code:
    					<center>
    <script type="text/javascript" src="http://www.metservice.com/assets/js/ms.widget.js"><!--
    /***********************************************
    
    * Dynamic Countdown script- Dynamic Drive
    
    (http://www.dynamicdrive.com)
    * This notice MUST stay intact for
    
    legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    
    ***********************************************/
    // --></script>
    <script type="text/javascript"><!--
    window.onerror = function(){return true;};
    new
    
    METS.Widget({id: 'MSwidgetOne',
    host: 'www.metservice.com',
    city: 'Hastings',
    type: 'two'});
    new
    
    METS.Widget({id: 'MSwidgetTwo',
    host: 'www.metservice.com',
    city: 'Napier',
    type: 'two'});
    // --></script>
    <div class="cleanslate MSwidget" id="MSwidgetOne"></div>
    <div class="cleanslate MSwidget" id="MSwidgetTwo"></div>
    </center>
    But you still miss out on the "Warnings in force".

    In fact, if you use the iframe method, or get rid of mootools, you could even use the type: 'one' widget and it would work.
    Last edited by jscheuer1; 09-07-2012 at 01:57 AM. Reason: discovered cause, add detail, improve code
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many thanks, I took the last option

Similar Threads

  1. Replies: 1
    Last Post: 01-28-2011, 03:39 AM
  2. Problem viewing shift reports
    By rhodarose in forum PHP
    Replies: 0
    Last Post: 11-25-2010, 05:08 AM
  3. AWstats script needed to run and merge all url stats reports
    By trader in forum Looking for such a script or service
    Replies: 2
    Last Post: 04-03-2009, 06:16 PM
  4. Looking for help with a script to do status reports.
    By solman in forum Looking for such a script or service
    Replies: 1
    Last Post: 09-05-2007, 10:40 PM
  5. Replies: 1
    Last Post: 12-10-2004, 11:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •