Share Facebook or Line with onclick function but get SEO problem Links are not crawlable

0 votes
Feb 19, 2022 in Others by Kichu
• 19,040 points
4,622 views

1 answer to this question.

0 votes

ignore the error message its nothing to fear about  try this code  as a reference and change your code accordingly 

var anchors = document.querySelectorAll('.sharer');

for(var z = 0; z < anchors.length; z++) {

anchors[z].addEventListener('click', function(e) {
//stop the default click action
  e.preventDefault();
// grab the base sharing URL
  var URL = e.target.getAttribute('data-url');
// grab the name we want to give the window (parameter 2 on window.open)
  var windowName = e.target.getAttribute('data-windowName');
// Grab parameter 3 for window.oprn (window settings)
  var windowSettings = e.target.getAttribute('data-settings');
// call window.open
  window.open(URL + window.location.href, windowName, windowSettings);
}, false);

}
<h2>Won't work on Stack Overflow due to sandbox so may need tweaking your side</h2>

<a class="sharer" href="http://www.facebook.com/share.php?u=https://stackoverflow.com/questions/64640807/share-facebook-or-line-with-onclick-function-but-get-seo-problem-links-are-not" data-url="http://www.facebook.com/share.php?u=" data-windowName="" data-settings="menubar=no,toolbar=no,resizable=no,scrollbars=yes,height=700,width=550" title="Facebook Share" aria-label="Facebook Share">Facebook</a>

<a class="sharer" href="http://line.naver.jp/R/msg/text/?Page title%0Ahttps://stackoverflow.com/questions/64640807/share-facebook-or-line-with-onclick-function-but-get-seo-problem-links-are-not" data-url="http://line.naver.jp/R/msg/text/?Page title%0A" data-windowName="Share with Line"  data-settings="height=700,width=550" title="Line Share" aria-label="Line Share">Line</a>

<h2>fallback behaviour</h2>
<p>The below shows how the link behaves with no javascript</p>

<a href="http://www.facebook.com/share.php?u=https://stackoverflow.com/questions/6464080
answered Feb 20, 2022 by narikkadan
• 86,360 points

Related Questions In Others

0 votes
1 answer
0 votes
1 answer

Problem with yoast SEO

This is (probably) not a problem of ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 86,360 points
1,042 views
0 votes
1 answer

how to show the <meta> values of yoast seo with some function?

check this folder : wordpress-seo\src\presenters\open-graph you can ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 86,360 points
1,242 views
0 votes
2 answers

Text console for development in JAWS?

Hi, I use/teach JAWS and have been ...READ MORE

answered Oct 17, 2022 in AWS by Garrett Mosley

edited Mar 5, 2025 2,647 views
0 votes
0 answers
0 votes
1 answer

H2 comes before h1 in source, Is it ok?

From browser's point of view, the order ...READ MORE

answered Sep 1, 2022 in Digital Marketing by Logan

edited Mar 5, 2025 4,202 views
0 votes
0 answers

Take my web page focus to browser address bar using javascript / jquery

Desired behavior : When a Tabkey press ...READ MORE

Aug 8, 2022 in Web Development by gaurav
• 23,580 points
1,637 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP