3

I am designing a support website which requires a "Quick Hide Site" button in a prominent position. I have created one using the following code on plunker

html

<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="style.css">
  </head>

  <body>
    <h1>Support Site</h1>
    <a class="hide" href="http://www.google.co.uk">Quick Hide Site</a>
  </body>

</html>

css

.hide{
    font-family: Helvetica, Arial, sans-serif;
    display:block;
    font-size:15px;
    color:#ffffff;
    text-decoration:none;
    text-align:center;
    line-height:0.9em;
    position:fixed;
    top:145px;
    right:0px;
    background-color:tomato;
    width:50px;
    padding:8px 3px 6px;
    -moz-box-shadow:0 3px 5px rgba(0, 0, 0, 0.25);
    -webkit-box-shadow:0 3px 5px rgba(0, 0, 0, 0.25);
    box-shadow:0 3px 5px rgba(0, 0, 0, 0.25);
    text-transform:uppercase;
    z-index:999999;
}

As some people don't use Google and have a different home page set in their browser, can I change the hyper-link in the html coding to get the visitor to go to their home page set in their browser instead of Google?

I have found this response in StockOverflow but where I am not familiar with JavaScript, I don't know how I would use the coding.

Community
  • 1
  • 1
Chris Rogers
  • 370
  • 3
  • 22
  • 2
    If you seriously do not understand or are able to implement the clear script in the answer you posted, then I do not see how we can help. There is no way in plain HTML to redirect a browser – mplungjan Mar 22 '14 at 14:34
  • 1
    "I am not familiar with JavaScript" well, there's your problem :) – Dunno Mar 22 '14 at 14:37

1 Answers1

1

As the link says

  1. Identify the type of browser the user is in, using javascript.
  2. Call the function to redirect the user to their homepage, again - using javascript

This link shows you exactly what code you need

Sean Routledge
  • 1,218
  • 1
  • 9
  • 12
  • solution no longer works on chromium-based browsers, no "window.home", no "about:home" – Dee Jul 16 '19 at 00:29