Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1226673
    alex5252
    Participant

    Hello I have a video that explains the issue.

    https://www.youtube.com/watch?v=q7vke7Mx2_4&feature=youtu.be

    the JS function that is doing this is the second code block in our global cornerstone javascript

    #1226674
    alex5252
    Participant
    This reply has been marked as private.
    #1226953
    Rad
    Moderator

    Hi there,

    Please check this link

    jQuery(document).ready(function($) { //link warning
    
      var confirmLeave = function(){
        var href = $(this).attr("href");
        var confirmMessage = "You are leaving State Bank of Pearl City's website. ";
        confirmMessage += "Links that may be accessed via Third Party Site are for the convenience of informational purposes only. ";
        confirmMessage += "Any products and services accessed through ";
        confirmMessage += href;
        confirmMessage += " are not provided or guaranteed by State Bank of Pearl City. ";
        confirmMessage += "The site you are about to visit may have a privacy policy that is different than State Bank of Pearl City's. ";
        confirmMessage += "Please review their privacy policy. ";
        confirmMessage += "State Bank of Pearl City does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.";
    
        var redirectConfirm = window.confirm(confirmMessage)
        if(redirectConfirm === false) {
          return false;
        } else if($(this).attr("target") !== "_blank"){
          window.location.href = href;
        }
      };
      
      $("#resourceArticle i.x-icon-external-link").off();
      $("#resourceArticle h4").off();
      
      $("#resourceArticle i.x-icon-external-link").on("click", function(){$(this).parent().parent().parent().parent().parent().next().children(".x-img").trigger("click");});
      $("#resourceArticle h4").on("click", function(){$(this).parent().parent().parent().next().children(".x-img").trigger("click");});
    
    	  $("#menu-item-289 a").click(confirmLeave);
      	$("#menu-item-290 a").click(confirmLeave);
      	$("#resourceArticle a.x-img").click(confirmLeave);
      	$("#calculators .x-column .x-text a").click(confirmLeave);
      	$(".x-social-global a").click(confirmLeave);
    
    });

    to this

    jQuery(document).ready(function($) { //link warning
    
    $(window).load( function() {
      var confirmLeave = function( e ){
    
        e.stopPropagation();
        e.preventDefault();
        
        var href = $(this).attr("href");
        var confirmMessage = "You are leaving State Bank of Pearl City's website. ";
        confirmMessage += "Links that may be accessed via Third Party Site are for the convenience of informational purposes only. ";
        confirmMessage += "Any products and services accessed through ";
        confirmMessage += href;
        confirmMessage += " are not provided or guaranteed by State Bank of Pearl City. ";
        confirmMessage += "The site you are about to visit may have a privacy policy that is different than State Bank of Pearl City's. ";
        confirmMessage += "Please review their privacy policy. ";
        confirmMessage += "State Bank of Pearl City does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.";
    
        var redirectConfirm = window.confirm(confirmMessage)
        if(redirectConfirm === false) {
          return false;
        } else if($(this).attr("target") !== "_blank"){
          window.location.href = href;
        }
      };
    
    setTimeout ( function(){
    
        $("#resourceArticle i.x-icon-external-link").off();
         $("#resourceArticle h4").off();
      
        $("#resourceArticle i.x-icon-external-link").off().on("click", function(){$(this).parent().parent().parent().parent().parent().next().children(".x-img").trigger("click");});
        $("#resourceArticle h4").off().on("click", function(){$(this).parent().parent().parent().next().children(".x-img").trigger("click");});
    
        $("#menu-item-289 a").off().click(confirmLeave);
        $("#menu-item-290 a").off().click(confirmLeave);
        $("#resourceArticle a.x-img").off().click(confirmLeave);
        $("#calculators .x-column .x-text a").off().click(confirmLeave);
        $(".x-social-global a").off().click(confirmLeave);
    
    }, 300 );  
      
    
    } );
    
    });

    This ensures that your javascript is loaded only after other javascript. Hence, overriding previously binded click and touch events on mobile.

    Thanks!

    #1227257
    alex5252
    Participant

    Thank you for the reply. I did put your new code in, but it is still now working. It is also no longer working on desktop. I’m not sure if I put the code in incorrectly or what, but if you could take a look I would appreciate that.

    #1227582
    Rad
    Moderator

    Hi there,

    I made some changes, it should work now. At least for two menu links based on your existing code.

    Thanks!

    #1227596
    alex5252
    Participant

    Thank you. It is woorkkng now, however it is promting me to click “ok” twice. Do you know why that might be?

    #1227876
    Rad
    Moderator

    Hi there,

    Looks like it’s triggering twice (touch and click).

    I changed it to this

    jQuery(document).ready(function($) { //link warning
    	$(window).load(function(){
        var confirmLeave = function(e){
    
          e.stopPropagation();
          e.preventDefault();
    
          var href = $(this).attr("href");
          var confirmMessage = "You are leaving State Bank of Pearl City's website. ";
          confirmMessage += "Links that may be accessed via Third Party Site are for the convenience of informational purposes only. ";
          confirmMessage += "Any products and services accessed through ";
          confirmMessage += href;
          confirmMessage += " are not provided or guaranteed by State Bank of Pearl City. ";
          confirmMessage += "The site you are about to visit may have a privacy policy that is different than State Bank of Pearl City's. ";
          confirmMessage += "Please review their privacy policy. ";
          confirmMessage += "State Bank of Pearl City does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.";
    
          var redirectConfirm = window.confirm(confirmMessage)
          if(redirectConfirm === false) {
            return false;
          } else if($(this).attr("target") !== "_blank"){
            window.location.href = href;
          }
        }
      
        setTimeout(function(){
    
          $("#resourceArticle i.x-icon-external-link").off();
          $("#resourceArticle h4").off();
    
          $("#resourceArticle i.x-icon-external-link").on("click", function(){$(this).parent().parent().parent().parent().parent().next().children(".x-img").trigger("click");});
          $("#resourceArticle h4").on("click", function(){$(this).parent().parent().parent().next().children(".x-img").trigger("click");});
    
          $("#menu-item-289 a").on('touchend click', confirmLeave);
          $("#menu-item-290 a").on('touchend click', confirmLeave);
          $("#resourceArticle a.x-img").click(confirmLeave);
          $("#calculators .x-column .x-text a").click(confirmLeave);
          $(".x-social-global a").click(confirmLeave);
    
        }, 300);
        
      });
    });
    
    jQuery(document).ready(function($) { //email warning
      var emailWarning = function(){
        var warningMessage = "Please do not include any sensitive personal or financial information such as social security numbers or account numbers. ";
        warningMessage += "If you would like to send us a secure message, please log in to Internet banking and use the secure messaging tools there.";
    
        var redirectConfirm = window.confirm(warningMessage)
        if(redirectConfirm === false) {
          return false;
        } else if($(this).attr("target") !== "_blank"){
          window.location.href = href;
        }
      };
    	
      $('a[href^="mailto"]').click(emailWarning);
    
    });
    
    jQuery(document).ready(function($){
      $("#menu-item-301 > ul").mouseover(function() {
         $("#menu-item-301 a.ubermenu-target").addClass("iframeHover");
      });
    });
    
    jQuery(document).ready(function($){
      $("#menu-item-301 > ul").mouseout(function() {
         $("#menu-item-301 a.ubermenu-target").removeClass("iframeHover");
      });
    });
    
    jQuery(document).ready(function($){
      $(".x-colophon.top").after('<footer class="x-colophon middle"><button><a href="tel:8154432725">Call<br>Pearl City</a></button><button><a href="tel:8152448800">Call<br>Mt. Carroll</a></button></footer>');
    });
    
    

    Cheers!

    #1228248
    alex5252
    Participant

    Thank you. That does seem to work now, however now I noticed when I click “Cancel” it doesn’t exit, it still redirect to the new website in the link instead of canceling.

    #1228450
    Rad
    Moderator

    Hi there,

    What browser does it happen? Seems okay from my end. Maybe that browser handles confirm window differently than desktop counterpart. Are we still on navigation’s link pop-up issue?

    Thanks!

    #1228451
    alex5252
    Participant

    I am on safari on iPhone 7.

    Yes, we are still on the nagigation link pop up issue.

    #1229756
    Rad
    Moderator

    Hi there,

    Have you decided to discontinue this pop-up? I checked and the script is disabled (commented) and the navigation links are gone.

    But personally, I prefer to put external links on page content than on the navigation. Because placing them on your navigation is also encouraging your user to easily abandon your site. And it’s much better to open them on browser tab/window.

    Thanks!

  • <script> jQuery(function($){ $("#no-reply-1226673 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>