Jump to content

Code injection is showing in my header in mobile view - HELP!

Recommended Posts

5 hours ago, elzzzzer said:

Hello,

No it's still there for me but it only comes up when you pull the screen down. It's like hidden under the header. Any help would be really appreciated!

Please check Settings > Advanced > Code Injection > Header >> And paste all code here. I think some code is missing, caused this problem

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Hey tuanphan,


Thanks! Have copy and pasted below:

 

<!-- BEGIN SHAREAHOLIC CODE -->
<link rel="preload" href="https://cdn.shareaholic.net/assets/pub/shareaholic.js" as="script" />
<meta name="shareaholic:site_id" content="ebf0e5313f6bfcd0c4fc83258c028425" />
<script data-cfasync="false" async src="https://cdn.shareaholic.net/assets/pub/shareaholic.js"></script>
<!-- END SHAREAHOLIC CODE -->

<div class="shareaholic-canvas" data-app="share_buttons" data-app-id="28931517" data-title="{title}" data-link="{permalink}"></div> 


<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
 $("nav#main-navigation > ul > li:nth-last-child(1) a").replaceWith($(".search-block"));
</script>

  <body>
    <!-- Ready to use Font Awesome. Activate interlock. Dynotherms - connected. Infracells - up. Icons are go! -->
  </body>
</html>

 


<body>
</body></body:><script data-ad-client="ca-pub-4434301114465626" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><body>
  
</body>
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v7.0" nonce="ULl3f2at"></script>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
  $(function(){
    let searchBlock = $('#block-yui_3_17_2_1_1636398349398_2010')
    .attr('id', '')
    .addClass('header-search-bar');

       /*Place Desktop Search Bar*/ 
    $(searchBlock).insertAfter($('.header-title-nav-wrapper'));
    $(searchBlock).clone().addClass('mobile-header-search-bar').appendTo($('[data-folder="root"] .header-menu-nav-folder-content'));
  })
</script>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
  $(function(){
    let searchBlock = $('#BLOCK-ID-HERE')
    .attr('id', '')
    .addClass('header-search-bar');

    /*Place Desktop Search Bar*/ 
    $(searchBlock).insertAfter($('.header-actions-action.header-actions-action--social'));

    /*Create & Place Mobile Search Link*/ 
    $('<div class="container header-menu-nav-item header-menu-nav-item--collection"><a href="/search">Search</a></div>').appendTo($('[data-folder="root"] .header-menu-nav-folder-content'));
  })
</script>

Link to comment
On 11/15/2021 at 8:06 PM, elzzzzer said:

Hey tuanphan,


Thanks! Have copy and pasted below:

 

<!-- BEGIN SHAREAHOLIC CODE -->
<link rel="preload" href="https://cdn.shareaholic.net/assets/pub/shareaholic.js" as="script" />
<meta name="shareaholic:site_id" content="ebf0e5313f6bfcd0c4fc83258c028425" />
<script data-cfasync="false" async src="https://cdn.shareaholic.net/assets/pub/shareaholic.js"></script>
<!-- END SHAREAHOLIC CODE -->

<div class="shareaholic-canvas" data-app="share_buttons" data-app-id="28931517" data-title="{title}" data-link="{permalink}"></div> 


<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
 $("nav#main-navigation > ul > li:nth-last-child(1) a").replaceWith($(".search-block"));
</script>

  <body>
    <!-- Ready to use Font Awesome. Activate interlock. Dynotherms - connected. Infracells - up. Icons are go! -->
  </body>
</html>

 


<body>
</body></body:><script data-ad-client="ca-pub-4434301114465626" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><body>
  
</body>
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v7.0" nonce="ULl3f2at"></script>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
  $(function(){
    let searchBlock = $('#block-yui_3_17_2_1_1636398349398_2010')
    .attr('id', '')
    .addClass('header-search-bar');

       /*Place Desktop Search Bar*/ 
    $(searchBlock).insertAfter($('.header-title-nav-wrapper'));
    $(searchBlock).clone().addClass('mobile-header-search-bar').appendTo($('[data-folder="root"] .header-menu-nav-folder-content'));
  })
</script>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
  $(function(){
    let searchBlock = $('#BLOCK-ID-HERE')
    .attr('id', '')
    .addClass('header-search-bar');

    /*Place Desktop Search Bar*/ 
    $(searchBlock).insertAfter($('.header-actions-action.header-actions-action--social'));

    /*Create & Place Mobile Search Link*/ 
    $('<div class="container header-menu-nav-item header-menu-nav-item--collection"><a href="/search">Search</a></div>').appendTo($('[data-folder="root"] .header-menu-nav-folder-content'));
  })
</script>

I think html/body tag in the code make the code invalid

Change to this code

<!-- BEGIN SHAREAHOLIC CODE -->
<link rel="preload" href="https://cdn.shareaholic.net/assets/pub/shareaholic.js" as="script" />
<meta name="shareaholic:site_id" content="ebf0e5313f6bfcd0c4fc83258c028425" />
<script data-cfasync="false" async src="https://cdn.shareaholic.net/assets/pub/shareaholic.js"></script>
<!-- END SHAREAHOLIC CODE -->

<div class="shareaholic-canvas" data-app="share_buttons" data-app-id="28931517" data-title="{title}" data-link="{permalink}"></div> 
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
 $("nav#main-navigation > ul > li:nth-last-child(1) a").replaceWith($(".search-block"));
</script>
<script data-ad-client="ca-pub-4434301114465626" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><body>

<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v7.0" nonce="ULl3f2at"></script>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
  $(function(){
    let searchBlock = $('#block-yui_3_17_2_1_1636398349398_2010')
    .attr('id', '')
    .addClass('header-search-bar');

       /*Place Desktop Search Bar*/ 
    $(searchBlock).insertAfter($('.header-title-nav-wrapper'));
    $(searchBlock).clone().addClass('mobile-header-search-bar').appendTo($('[data-folder="root"] .header-menu-nav-folder-content'));
  })
</script>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
  $(function(){
    let searchBlock = $('#BLOCK-ID-HERE')
    .attr('id', '')
    .addClass('header-search-bar');

    /*Place Desktop Search Bar*/ 
    $(searchBlock).insertAfter($('.header-actions-action.header-actions-action--social'));

    /*Create & Place Mobile Search Link*/ 
    $('<div class="container header-menu-nav-item header-menu-nav-item--collection"><a href="/search">Search</a></div>').appendTo($('[data-folder="root"] .header-menu-nav-folder-content'));
  })
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.