Advertisement

09.12.2008 at 11:28AM PDT, ID: 23727347
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

JavaScript error in Internet Explorer

Asked by Tx74Qp853mR in JavaScript, Hypertext Markup Language (HTML), JScript

Tags:

Dear experts,

This JavaScript gives an error in InternetExplorer6 (sometimes) but works perfectly in Firefox3.

<script type="text/javascript">
      <!--
      // Create Book Mark - CBM()
      function CBM() {
      
            var title = "domain.com";
            // Blogger - Replace with <$BlogItemTitle$>
            // MovableType - Replace with <$MTEntryTitle$>
            
            var url = "http://domain.com";
            // Blogger - Replace with <$BlogItemPermalinkURL$>
            // MovableType - Replace with <$MTEntryPermalink$>
            // WordPress - <?php bloginfo('url'); ?>
            
            if ( window.sidebar ) { // Mozilla Firefox Bookmark    <===== error #2 here
                  window.sidebar.addPanel( title, url, "" );             <===== error #1 here
            }
            else if( window.external ) { // IE Favorite
                  window.external.AddFavorite( url, title );
            }
            else if( window.opera && window.print ) { // Opera Hotlist
                  return true;
            }
      } // END: CBM()

      document.write( '<a href="javascript:CBM()">Bookmark</a>' );
      //
      //-->
</script>

Error #1 is "Microsoft JScript runtime error: object doesn't support this property or method".  

This error only happens on certain pages and not on others.  But the pages are structured exactly the same, from the <!DOCTYPE html declaration at the top to the place where the script occurs.  The script is part of a nav bar at the top of the page, which is identical in all pages of the website.  The pages where the error occurs do have different content from the pages where it doesn't occur, but the different content happens after the identical top-of-page content.

Note that the script works perfectly well on Firefox3 on ALL the pages where IE6 breaks.

I tried doing:
if ( window.sidebar.addPanel )
but then I get error #2 in IE6:

Error #2 is: "window.sidebar.addPanel is null or not an object" -- AND now IE6 breaks on the pages where it worked before, and it works on the pages where it broke before -- AND the script continues to work perfectly well in FF3 !!!

How do I modify this script to get around these IE6 issues?

Or is there a better way to detect browser capabilities (caps) and launch the appropriate bookmark method for the current browser caps?

I don't want to detect browsers -- that's a losing game.

Thanks.
Start Free Trial
[+][-]09.12.2008 at 11:34AM PDT, ID: 22462636

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 01:33PM PDT, ID: 22463632

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 02:00PM PDT, ID: 22463866

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Hypertext Markup Language (HTML), JScript
Tags: JavaScript
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.14.2008 at 11:46PM PDT, ID: 22476264

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628