Change the URL Text into an Active Link use JavaScript

Change the URL Text into an Active Link use JavaScript - Hallo friend Cara Mudah Posting Gratisan, In the article you read this time with the title Change the URL Text into an Active Link use JavaScript, we have prepared well for this article you read and download the information therein. hopefully fill posts Article Javascript, Article Snippet, Article Trik dan Tips, Article Tutorial, we write this you can understand. Well, happy reading.

Title : Change the URL Text into an Active Link use JavaScript
link : Change the URL Text into an Active Link use JavaScript

Also Read


Change the URL Text into an Active Link use JavaScript

Tidak mau menulis link tujuan karena takut unsur badlink atau backlink yg tidak sesuai dengan tema blog sobat? Trik dan tips kali ini akan berbicara bagaimana cara merubah teks URL menjadi link hidup! URL/link yg tertera pada address browser biasanya akan dimulai dengan http:// or https:// Koben juga sering menuliskan link hanya dengan menuliskan alamatnya saja tanpa sintax hyperlink :D Ketika sobat menuliskan alamat seperti berikut:
  • http://www.google.com/
  • https://www.google.com/
  • ttp://example.com/~pages/pa-ge/?param=foo+bar
  • ttp://beben-koben.blogspot.com/2014/05/selection-good-resources-may-2014.html
  • https://www.google.com/search?q=tutorial
Itu nanti akan berubah menjadi hyperlink aktif yg bisa di klik dan terbuka dengan jalan new tab window.

Sobat tinggal menanamkan JavaScript berikut...
<script type='text/javascript'>
//<![CDATA[
document.addEventListener("DOMContentLoaded",function(){for(var t=document.evaluate('descendant::text()[contains(self::text(),"ttp") and not(ancestor::a) and not(ancestor::textarea) and not(ancestor::script) and not(ancestor::style)]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),e=0;e<t.snapshotLength;e++){var n=t.snapshotItem(e);n.textContent.match(/h?ttps?:\/\/[a-zA-Z0-9\.\/\-_~\?=&%\+]+/g).forEach(function(t){var e=n.textContent.indexOf(t),a=document.createRange();a.setStart(n,e),a.setEnd(n,e+t.length);var o=document.createElement("a");o.setAttribute("href",0==t.indexOf("http")?t:"h"+t),o.addEventListener("click",function(t){window.open(this.getAttribute("href")),t.preventDefault(),t.stopPropagation()}),a.surroundContents(o),a.detach()})}});
//]]>
</script>
Source by: jsdo.it/kobachi/urltext2anchor

Happy coding \m/



Thus articles Change the URL Text into an Active Link use JavaScript

that is all articles Change the URL Text into an Active Link use JavaScript This time, hopefully can provide benefits to all of you. Okay, see you in another article posting.

You now read the article Change the URL Text into an Active Link use JavaScript with the link address https://autopostingblogspot.blogspot.com/2014/05/change-url-text-into-active-link-use.html

0 Response to "Change the URL Text into an Active Link use JavaScript"

Posting Komentar