Friday 24 August 2018

List ribbon not load issue in Office 365

Issue:
Recently, we have a strange issue. The list was not showing ribbon tabs default. There are many reasons I found for this behavior, like

  • Permission issue - we have site collection access
  • custom script to stop ribbon load - we have checked there was no custom coding done.

Then we found a blog stating that even if you add any custom webpart in list / library page, the ribbon lost its focus from main webpart. So it won't show. Andd it was true. we have added a legal text in our list heading using content editor webpart.

Solution:

So what is solution to bring it back? Below is code sample that we added in our page for loading ribbon tab on page load.

Code:
window.onload = function(){
  var elem = document.getElementById("MSOZoneCell_WebPartWPQ2");
  if (elem != null) {
      var dummyevent = new Array();
      dummyevent["target"] = elem;
      dummyevent["srcElement"] = elem;
      elem.parentNode.click();
      WpClick(dummyevent);
   }
//code to click browse button
   document.getElementsByClassName("ms-cui-tt-span")[0].click();
   }

Wednesday 8 August 2018

HTML 5 Video tag

As always, I was working on a project which contains bugs. but this time a video was issue. Issue was video was playing in most of browser but not in Internet Explorer. As a part of analysis I found that client was using some third party browser to render video.

So I checked alternative for that. And what I get is HTML 5 video tag. Below is code that I used for testing:

<html>
<head>
</head>
<body>
<video controls autoplay loop>
  <source src="https://www.w3schools.com/tags/movie.mp4" type="video/m4v">
Your browser does not support the video tag.
</video>
</body>
</html>

Few things that it provides is very good. for example, below attributes

  • Autoplay - if you add this in video tag, video will start automatically. 
  • Loop - Provides a way to play video continuously.
You can check other attributes as well in reference link below.

Our client was using "M4a" format. But video tag supports below formats only. So we change our video format in "MP4"
  • MP4 - This only is supported in IE, Chrome and Firefox.
  • WebM
  • Ogg

Note: The video tag is not supported in Internet Explorer 8 and earlier versions.

As it solved my problem, I thought its worth sharing for my future reference and it my help you.

Reference:
https://www.w3schools.com/tags/tag_video.asp