Q:

javascript change url

 window.location.href = "www.google.com"; 
0
history.pushState({}, null, newUrl);
2
 function processAjaxData(response, urlPath){
     document.getElementById("content").innerHTML = response.html;
     document.title = response.pageTitle;
     window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
 }
0
function URLReplacer(str){
        let match = str.match(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig);
        let final=str;
        match.map(url=>{
            final=final.replace(url,"<a href=\""+url+"\" target=\"_BLANK\">"+url+"</a>")
        })
        return final;
      }
0

New to Communities?

Join the community