JQuery Tabs in C# MVC to stay on reload
If browser compatibility matrix satisfies your requirements (see CanIUse) then there is a simpler way to check if page is reloaded, read window.performance.navigation.type value. For reload event value is TYPE_RELOAD then you may simply drop your hidden input and:

if (window.performance.navigation.type != 1) {
    activeTab = "";
}


See also W3C specs for further details.



If you're not targeting IE you may want to use template literals instead of string concatenation, for example:

$(`#myTab a[href="${activeTab}"]`).tab('show');




Value you're persisting in localStorage does not need to be retained across different sessions then you'd better use sessionStorage instead. It also has the advantage to be isolated by window (or tab).



You may want to use let and, where appropriate, const instead of var.



To put everything all together you may want to revert the condition you're checking to simplify your code:

$(document).ready(function () {
    $('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
        sessionStorage.setItem('activeTab', $(e.target).attr('href'));
    });

    if (window.performance.navigation.type === 1) {
        const activeTab = sessionStorage.getItem('activeTab');
        $(`#myTab a[href="${activeTab}"]`).tab('show');
    }
});




The recommended way to attach an handler to the ready event is:

$(function () {
    // ...
});


Absolutely nothing wrong with the verbose way (which BTW I find more clear).



I add this only because you may find it useful in future, to detect a page refresh may be done also server side, see asp.net mvc - Detecting page refresh.