Coffeehouse Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

New IE9 pinned feature, how to fix error for chrome and firefox?

Back to Forum: Coffeehouse
  • User profile image
    kernelm

    Hello,

    The new IE9 is a great product, but not everyone is using it right know.  I noticed that if you add the new meta-data configuration to support pinned sites, it works great in IE9 but in other browser such as chrome and firefox you get an error like this, when you are inspecting elements and you included the javascript:

    <script type="text/javascript"> // You must call this at least once window.external.msSiteModeCreateJumplist('Tasks'); //then call this for each list item window.external.msSiteModeAddJumpListItem('Take out laundry', 'task1.htm', 'images/item1.ico');window.external.msSiteModeAddJumpListItem('Check my mail', 'task2.htm', 'images/item2.ico');window.external.msSiteModeCreateJumplist('Personal');window.external.msSiteModeAddJumpListItem('Change my user details', 'user.htm', 'images/item3.ico');window.external.msSiteModeAddJumpListItem('Change password', 'pass.htm', 'images/item4.ico');window.external.msSiteModeAddJumpListItem('Logout', 'logout.aspx', 'images/item5.ico'); //display the list window.external.msSiteModeShowJumplist(); </script>

     

    Uncaught TypeError: Object #<an Object> has no method 'msSiteModeCreateJumplist' this error comes from this line 

    window.external.msSiteModeCreateJumplist('Tasks');

    how can i stop this error for showing up in other browser? there is any way to check the browser
    before executing the javascript and run it only if IE9 is present?

    Thanks,

     

  • User profile image
    sushovan

    I assume you already tried the standard "feature-detection" by wrapping everything in a

    if (window.external.msSiteModeCreateJumplist) { ... }

    block?

  • User profile image
    W3bbo

    how can i stop this error for showing up in other browser? there is any way to check the browser before executing the javascript and run it only if IE9 is present? 

    That's only half-way right. Rather than checking to see if a browser is IE9, you should check if the browser supports that particular feature. Never discriminate by browser version or by the UA string; as sushovan stated, do feature-detection.

    Almost every article on the IEBlog discussing new features always advises developers to use feature detection, such as this article.

  • User profile image
    PerfectPhase

    @kernelm:  If the task list is static you can just use the meta tags instead, otherwise as they above said.

    <meta name="msapplication-task" content="name=Weekly Podcast;action-uri=/blog/CategoryView.aspx?category=Podcast;icon-uri=/blog/images/podcast.ico" />

     

  • User profile image
    kernelm

    @sushovan:

    Thank you guys for the answers!

    I think I made a mistake in the code above. I am using a code similar to this: 

    <script type='text/javascript'>
    
    function customJumplist() {
    window.external.msSiteModeCreateJumplist('Blogs');
    window.external.msSiteModeAddJumpListItem('Blog Directory', 'http://windowsteamblog.com/b/','http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/bloglist.ico');
    window.external.msSiteModeAddJumpListItem('Windows for your Business Blog', 'http://windowsteamblog.com/windows/b/business/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeAddJumpListItem('Windows Experience Blog', 'http://windowsteamblog.com/windows/b/windowsexperience/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeAddJumpListItem('Windows Phone Blog', 'http://windowsteamblog.com/windows_phone/b/windowsphone/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/winphone.ico');
    window.external.msSiteModeAddJumpListItem('Exploring IE', 'http://windowsteamblog.com/ie/b/ie/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/ie2.ico');
    window.external.msSiteModeAddJumpListItem('Inside Windows Live', 'http://windowsteamblog.com/windows_live/b/windowslive/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeAddJumpListItem('Blogging Windows', 'http://windowsteamblog.com/windows/b/bloggingwindows/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeShowJumplist(); 
    }
    
    customJumplist();
    
    </script>

    when wrapping everything with: if (window.external.msSiteModeCreateJumplist) { ... } you also meant including  <script type='text/javascript'> and function customJumplist() {   ? like this:

    if (window.external.msSiteModeCreateJumplist) { <script type='text/javascript'>
    
    function customJumplist() {
    window.external.msSiteModeCreateJumplist('Blogs');
    window.external.msSiteModeAddJumpListItem('Blog Directory', 'http://windowsteamblog.com/b/','http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/bloglist.ico');
    window.external.msSiteModeAddJumpListItem('Blogging Windows', 'http://windowsteamblog.com/windows/b/bloggingwindows/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeShowJumplist(); 
    }
    
    customJumplist();
    
    </script> }

    or

    <script type='text/javascript'>
    if (window.external.msSiteModeCreateJumplist) { 
    function customJumplist() {
    window.external.msSiteModeCreateJumplist('Blogs');
    window.external.msSiteModeAddJumpListItem('Blog Directory', 'http://windowsteamblog.com/b/','http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/bloglist.ico');
    window.external.msSiteModeAddJumpListItem('Blogging Windows', 'http://windowsteamblog.com/windows/b/bloggingwindows/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeShowJumplist(); 
    }
    customJumplist(); }
    </script>


    Sorry, I am just starting and I dont know too much : (
    Thanks!
  • User profile image
    ZippyV

    <script type='text/javascript'>
    function customJumplist() {
    window.external.msSiteModeCreateJumplist('Blogs');
    window.external.msSiteModeAddJumpListItem('Blog Directory', 'http://windowsteamblog.com/b/','http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/bloglist.ico');
    window.external.msSiteModeAddJumpListItem('Blogging Windows', 'http://windowsteamblog.com/windows/b/bloggingwindows/', 'http://windowsteamblog.com/cfs-file.ashx/__key/CommunityServer-Components-SiteFiles/icons/windows.ico');
    window.external.msSiteModeShowJumplist();
    }
    
    if (window.external.msSiteModeCreateJumplist) {
    customJumplist();
    }
    </script>

  • User profile image
    joechung

    @W3bbo: Never say never. Sometimes there are bugs that are specific to browser versions.

    Others: Use "msSiteModeCreateJumplist" in window.external instead.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.