-2

when I send message to user <a href="www.link.com"> new link </a>

then when user try to click on it redirect to this address in browser: "www.link.com"

How can send the code to appears without "" in user side?

Thanks

5
  • 1
    I'm not able to replicate the behavior you describe. Can you update the question to include an example which demonstrates the problem?
    – David
    Apr 27, 2021 at 17:09
  • Did you actually check the source code and what exactly is sent to the browser? Are you sure that it's not something like href='"www.link.com"' or href="%22www.link.com%22"?
    – Thomas
    Apr 27, 2021 at 17:25
  • Actually if I set href="www.link.com" then appears to the browser mywebsite.com/"www.link.com" Apr 27, 2021 at 17:32
  • That because (as I've said) without the protocol, the system is going to look for a file (not a website) named: www.link.com. That's fine if you want to link to a file that's part of your site (like another page: <a href="somePage.html">), but not when you want to link to another site. And, as I've said, you must have some other code causing the quotes that you are not showing. Apr 27, 2021 at 17:35
  • After I check in Database appears in this format: <a href=\"www.link.com\">New </a > Apr 27, 2021 at 17:50

1 Answer 1

1

You must include the protocol in the address:

 <a href="http://www.link.com"> 

or:

 <a href="https://www.link.com">

Otherwise, the browser just sees "www.link.com" as a file name and tries to load that.

Here's a working example:

<a href="http://www.example.com">Click here to go to Example.com</a>

5
  • Interesting that you have voted to close the question as well as answering it.
    – Nigel Ren
    Apr 27, 2021 at 17:07
  • No, is not depend on https or http . whatever link I put there then appears with "" in browser Apr 27, 2021 at 17:07
  • @NigelRen The original question did not show the HTML because it wasn't marked as code in the question, so I voted to close. I then realized that the code was there and edited the question to show it, but by then, it was too late to retract my close vote. Apr 27, 2021 at 17:19
  • 1
    @JohnMartins That is not behavior that would happen if you code as I've shown. You must have a different issue causing this. And yes, you must include the protocol, otherwise the system will be looking for a file, not a website. Apr 27, 2021 at 17:21
  • I understand, thanks for your replies. Apr 27, 2021 at 17:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.