Javascript: replace /escape character

venkatesh padmanabhan 181 Reputation points
2022-06-01T07:02:16.053+00:00

Hi.

I am trying to do a javascript change location bookmarklet - if condition to replace with another URL

javascript:if(location.host=='abc')(location.href='http://cde'+location.pathname+'\?test\=enable');

The code works fine, but the last ' comes as %27 . How to correct this ?
Thanks

Developer technologies | ASP.NET | Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.