-1

I understand that it is possible to hide the url in the browser status bar by using javascript, but with this method, the url can be seen when the source is viewed from the browser. how to hide URL from downloadlink?

We are using PHP Laravel. I would like to know how to create a link button so that the user does not see the url. I am assuming that this might need to be implemented at the server (controller) side not a view side. I would like to know the easiest way.

  • 2
    HTML links and forms are the native way to communicate with the server over HTTP, and, with no intervention, the destination is viewable in the source. You can use JS to obfuscate this, but the browser will still end up at the destination (although automatic server redirects can hide this for some people). You can switch to AJAX/fetch to remove the browser address bar but this is still viewable in the network inspection tool. Ultimately, this feels like an attempt at “security through obscurity”, I can’t imagine a valid reason for actually doing this. – Chris Haas Sep 01 '22 at 01:43
  • 1
    The question is **why**. The only valid reason is to hide the location that files are downloaded from. There is a solution for this without using javascript. If this is not the reason then I would suggest that it is foolish to hide the URL that a link is going to go to. – Rohit Gupta Sep 01 '22 at 02:34
  • 1
    This sounds like a [XY](https://en.wikipedia.org/wiki/XY_problem) problem. Instead of asking how to implement your solution (which sounds unlikely to work the way it's written), state what you're trying to achieve/what are you trying protect/prevent. – Evert Sep 01 '22 at 03:04

1 Answers1

-1

There are basically three different ways to hide links in HTML.

The first way is to use the tag without the href attribute. This hides the link from the HTML reader, but the link will still be clickable in the browser.

The second way is to use the tag with the href attribute, but place the entire link inside a span tag.

The third way is to place the entire link inside a span tag, and then you can use CSS to hide that span tag.

Whichever way you choose to hide the link, your link will still be clickable. When the link is clicked, it will still open in the browser window. Hiding links is very easy in HTML.

vatsal mangukiya
  • 261
  • 2
  • 14
  • Can you give an example of each, specifically of a tag that has no href but is still clickable in a browser? The OP is also guarding against “view source” so I’m curious how your very easy solutions work. – Chris Haas Sep 01 '22 at 12:15