Ask a questionAsk a question
 

AnswerJavaScript locking up IE Browser

  • Monday, September 24, 2007 6:57 PMbanderson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    I am trying to use the following JS on my MS Office Live web pages:

     

    <!-- start RatePoint Badge - Please, do not change -->
    <script language="JavaScript" type="text/javascript" src="//badge.ratepoint.com/member/cap.js"></script>
    <!-- end RatePoint Badge - Please, do not change -->

     

    I am inserting a module, pasting the code and saving.  Then, IE locks up when I am trying to view and I need to shut down the browser.  Would I need to use webbots like in FrontPage?  If not, any ideas why Live will not accept this code?  I would really appreciate any advice on this issue.

     

    Thanks alot

     

    Bob

Answers

  • Wednesday, September 26, 2007 5:21 PMChris Beiter - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi Bob,

     

    There is a bug in IE that causes it to lock up when you use <SCRIPT SRC... > to link to an 'external' javascript file.  We ran into this last month.  Here's an excerpt from this related thread.

     

    The Office Live HTML Module is written out dynamically to the browser.  Because of the way IE handles (or does not handle) <SCRIPT> tags with external SRC attributes that are dynamically written to the page, the array is not being created by the time you try to document.write it out.

     

    There is a work-around to this issue in IE by adding the "defer" attribute to the SCRIPT tag.

     

    The full thread can be found here:  http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1962391&SiteID=1

     

    The defer attribute tells the browser not to process the JS in the external file until after the rest of the page is loaded.  This works around the bug in IE.  So, I think all you may need to do is write <script ....  defer='true'>  or just <script....  defer>.  If you have any code in the JS file that you are expecting to run at load time, you will need to bootstrap it somehow through other event such as the window.onload event.

     

    Hope that helps.

     

    Thanks,

    Chris

All Replies

  • Wednesday, September 26, 2007 5:21 PMChris Beiter - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi Bob,

     

    There is a bug in IE that causes it to lock up when you use <SCRIPT SRC... > to link to an 'external' javascript file.  We ran into this last month.  Here's an excerpt from this related thread.

     

    The Office Live HTML Module is written out dynamically to the browser.  Because of the way IE handles (or does not handle) <SCRIPT> tags with external SRC attributes that are dynamically written to the page, the array is not being created by the time you try to document.write it out.

     

    There is a work-around to this issue in IE by adding the "defer" attribute to the SCRIPT tag.

     

    The full thread can be found here:  http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1962391&SiteID=1

     

    The defer attribute tells the browser not to process the JS in the external file until after the rest of the page is loaded.  This works around the bug in IE.  So, I think all you may need to do is write <script ....  defer='true'>  or just <script....  defer>.  If you have any code in the JS file that you are expecting to run at load time, you will need to bootstrap it somehow through other event such as the window.onload event.

     

    Hope that helps.

     

    Thanks,

    Chris

  • Saturday, December 22, 2007 9:36 PMrudy-s Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Chris, this code may allow me to do what I have been wanting to do. I had been using Google Analytics and Google Adwords when I was using a different website hosting service. last week I discovered OfficeLive and was struck by the simolicity. I wanted to continue using GA and inserted the javascript code they made available and noticed that my browser was being locked up.

     

    Could you please write down exactly how the suggested fix <script... defer = 'true'> should appear?? I am not an HTML expert. Should it precede the suggested script that GA provides to add on to the website??

     

  • Wednesday, January 02, 2008 5:55 PMChris Beiter - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry, I can't speculate on what will or won't work for Google, and that's off topic for this forum.