none
Cookie related issue RRS feed

  • Question

  • The SharePoint portal uses cookie for showing the content in native (local) language while accessing the portal first time. 

    Javascript is used to store the selected language variable. 

    var contrl = document.getElementById('LangSwticherAnchor');
            var SelectedLangText;
            if (contrl != null || contrl != undefined) {
                SelectedLangText = $.cookie("Portal_MENU_LANG");
     
    But from today onwards, the SharePoint Portal is showing the content in english instead of native language in the first load. 

    What could be the reason ? 
    Wednesday, December 28, 2016 1:01 PM

All replies

  • Hi,

    Does the Portal_MENU_LANG belongs to your custom solution? If so, you’d better check the logic for it.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, December 29, 2016 4:52 AM
  • Hi,

    It looks cookie might have been expired or got cleared from the browser.

    Please ensure the cookie is available before assigning to ,this code snippet helps you to identify the cookie availability

    window.getCookie = function(name) {
      match = document.cookie.match(new RegExp(name + '=([^;]+)'));
      if (match) return match[1];
    }


    Murugesa Pandian | MCPD | MCTS | SharePoint 2010 |

    Thursday, December 29, 2016 5:40 AM
  • In the Window Load Function, I am checking whether it is null or not. If it is null, I set the value as Arabic. 

    $(window).load(function () {
        try {
            if ($.cookie("Portal_MENU_LANG") == null) {
                for (i = 0 ; i < arrSubSites.length ; i++) {
                        $.cookie("Portal_MENU_LANG", 'عربي', { path: arrSubSites[i] });
                }

    Do I need to do anything from the SharePoint Side ? Please advise.

    Thursday, December 29, 2016 6:01 AM
  • Hi,

    You could use it in SharePoint directly, may you could use new library below:

    https://github.com/js-cookie/js-cookie

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, December 29, 2016 7:20 AM
  • Hi,

    It looks good for me now, still you can check the cookies are available to your browser session by using the "Fiddler".

    More information regarding this , "Viewing the cookie information using Fiddler"


    Murugesa Pandian | MCPD | MCTS | SharePoint 2010 |

    Thursday, December 29, 2016 7:51 AM