Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

made clickable url in js

/*****Make Urls clickable in JS*****/
function prepareHtml(s)
{
	if(!s) return '';
	// make URLs clickable
	s = s.replace(/(^|s|>)(www.([w#$%&~/.-+;:=,?[]@]+?))(,|.|:|)?(?=s|&quot;|&lt;|&gt;|"|<|>|$)/gi, '$1<a href="http://$2" target="_blank">$2</a>$4');
	return s.replace(/(^|s|>)((?:http|https|ftp)://([w#$%&~/.-+;:=,?[]@]+?))(,|.|:|)?(?=s|&quot;|&lt;|&gt;|"|<|>|$)/ig, '$1<a href="$2" target="_blank">$2</a>$4');
};
Comment

make url clickable js


//////// posted by Programmer Rimon\\\
// Date: 07-02-2022 *D-M-Y*
function makeUrlsClickable(s) {
	if(!s) return '';
	// make URLs clickable
	s = s.replace(/(^|s|>)(www.([w#$%&~/.-+;:=,?[]@]+?))(,|.|:|)?(?=s|&quot;|&lt;|&gt;|"|<|>|$)/gi, '$1<a href="http://$2" target="_blank">$2</a>$4');
	return s.replace(/(^|s|>)((?:http|https|ftp)://([w#$%&~/.-+;:=,?[]@]+?))(,|.|:|)?(?=s|&quot;|&lt;|&gt;|"|<|>|$)/ig, '$1<a href="$2" target="_blank">$2</a>$4');
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: js test letter lowercase 
Javascript :: jquery radio button checked event 
Javascript :: int to octal javascript 
Javascript :: how to select a random value in a json array LUA 
Javascript :: how to save data i mongi db 
Javascript :: node redisjson remove path 
Javascript :: switch browser to fullscreen 
Javascript :: document not intialized react js 
Javascript :: react native monorepo module resolver outside app 
Javascript :: flutter keep local storage even after is closed 
Javascript :: remove attribute disabled 
Javascript :: javascript toggle variable 
Javascript :: test if is undefined javascript 
Javascript :: button click javascript 
Javascript :: javascript group by sum array reduce 
Javascript :: cnpj pattern js 
Javascript :: jquery get link href value 
Javascript :: jquery create html element 
Javascript :: Introdução ao nodeJs 
Javascript :: how to understand if nodejs is out of memory 
Javascript :: js reverse array of objects 
Javascript :: js revers string fucntion 
Javascript :: how to communicate between nodejs applications 
Javascript :: js remove end comma 
Javascript :: js does forEach respect order 
Javascript :: get current url javascript 
Javascript :: remove file from input type file jquery 
Javascript :: xmlhttp js post request 
Javascript :: jquery if div is empty 
Javascript :: odoo popup input not taking keyboard value 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =