-1

This is probably a simple question but I can't seem to find what I am looking for on the web so here it goes. I have a link on my company INTRAnet site that senior management does not want the employees to see the actual web address (via the source option on the View tab of IE).

Please let me know how I can do this in HTML, asp.net or JS.

Thanks!

:)

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
user2267619
  • 9
  • 1
  • 1
  • 5
    Do you realise that whatever you do, the URL will be visible when they click the link? – John Dvorak Apr 10 '13 at 19:25
  • 1
    To be clear, Senior Management wants the employees to be able to click the link but not to be able to see where they are going? – pete Apr 10 '13 at 19:26
  • 3
    A [Url Shortening](http://en.wikipedia.org/wiki/URL_shortening) service like bitly or tinyurl will obfuscate the url but eventually the users will see the real url on their browser address bar. – Jasen Apr 10 '13 at 19:36
  • @pete: That sounds like a safe idea ^_^ – gen_Eric Apr 10 '13 at 19:52
  • 2
    I won't downvote, but this can't be done. period end of story eventually the link shows up in the address bar and can be copied. – Ryan Apr 10 '13 at 20:42

5 Answers5

6

You can't. Tell senior management to quit being so secretive.

Jason Dean
  • 9,585
  • 27
  • 36
0

Not sure if this is what you want, but here is a similar Question:

php encrypt and decrypt

Does it help at all? There is another, but it is a php code:

http://php.net/manual/en/function.mcrypt-encrypt.php

Also, what language are you looking to implement the code?

Alernatively, you can use this site: http://www.iwebtool.com/html_encrypter and on the box you type your html e.g.

     <a href="https://stackoverflow.com/posts/5934696"> This is your post link</a>

Then use the "Encrypt" button. It will return you the javascript you are looking for.

E.g.

     "<"Script Language='Javascript'>
         document.write(unescape('%3C%61%20%68%72%65%66%
         3D%22%68%74%74%70%3A%2F%2F%73%74%61%63%6B%6F%76%65%72%66%6C%
         6F%77%2E%63%6F%6D%2F%70%6F%73%74%73%2F%31%35%39%33%34%36%39%
         36%22%3E%54%68%69%73%20%69%73%20%79%
         6F%75%72%20%70%6F%73%74%3C%2F%61%3E'));
     </Script>

No jsFiddle because that javascript isn't allowed. your example

Community
  • 1
  • 1
Mee
  • 158
  • 7
  • i am looking for asp.net or javascript – user2267619 Apr 10 '13 at 19:42
  • going out for dinner. let me know if it worked or not. ill follow it up in 20 mins. cheers m8 – Mee Apr 10 '13 at 19:46
  • lol @rocket hazmat.. what did you edit? just the name and the end question? – Mee Apr 10 '13 at 20:09
  • @Mee: Yeah, I removed your name at the end of the post. http://stackoverflow.com/faq#signatures – gen_Eric Apr 10 '13 at 20:49
  • @RocketHazmat Ty :D Anyways, just done it in a "compliment" way. Good Night ;D – Mee Apr 10 '13 at 23:03
  • Thank you sooo much Mee... you rock! worked and I am happy with it... as for the Address bar... obviuosly mgmt didn`t think that far ahead and I guess I was not on my game yesterday either :/ but I explained everything the above code works! :) – user2267619 Apr 11 '13 at 14:26
  • Thank you everyone for all of your help and input! – user2267619 Apr 11 '13 at 14:26
  • You most welcome. A pleasure. Can you mark it as the correct answer for future reference? – Mee Apr 11 '13 at 14:45
0

First and foremost, it's impossible to hide the url from the browser. The browser has to request the webpage from the server, and even if the url was obscured somehow, it would have to be plaintext in the HTTP Request, which would open it up to a man-in-the-middle utility like Fiddler.

Second, this feels like security through obscurity. Resources that certain people shouldn't have access to should be locked down explicitly, not just hidden because the user doesn't know the url (yet).

However, purely as a thinking exercise... I suppose... you could write a handler that knows the real url, uses code to retrieve the content of the page, and then writes that to the response. So the users would see the handler url, but not where the handler is pulling it's data from. However, you'd then have to go to great lengths to find all links and resources on the page and convert those references to also go through your handler.

Of course, practically speaking, I think this concept is silly. There's some problem your senior management is trying to solve, and hiding the url from the user is not the answer.

Jason P
  • 26,984
  • 3
  • 31
  • 45
0

If upper management is this secretive then it's a safe bet that you also already have IT people who have browsers locked down as well, meaning Internet Explorer. It's possible that your IT team might be able to force the address bar to hide for all browsers within your company. I don't think that this can be done on a per request basis. Meaning that the address bar would either be on or off all the time.

According to this post your IT team might be able to update the registry to hide the address bar like so:

Run following RegKey:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\ToolBars]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\ToolBars\Restrictions]
"NoNavBar"=dword:00000001

Here's a google search that might also offer additional information.

commadelimited
  • 5,656
  • 6
  • 41
  • 77
0

Well rather than making it disappear you can make it hard for others to see through and even impossible for those who have no knowledge of base-64. Here is a code :

 var a = document.querySelectorAll("*"), b = 0;
   for ( b = 0; b < a.length; b ++ ) {
     if ( a[b].hasAttribute("data-href") ) {
       a[b].href = atob( a[b].getAttribute("data-href") );
     };
   };

Now you can call something like this :

 <a data-href="aHR0cDovL3d3dy5teWNvbXBhbnkuY29t">Go</a>

By using btoa() I converted "http://www.mycompany.com" to "aHR0cDovL3d3dy5teWNvbXBhbnkuY29t" in base-64 and designed "data-href" to understand the encoding. Behind all this it will look and act like :

<a href="http://www.mycompany.com">Go</a>
Debarchito
  • 1,305
  • 7
  • 20