How to Redirect URL on Google Sites

Jay M. picture Jay M. · Apr 23, 2014 · Viewed 8.3k times · Source

Okay, so I have a Google Site that I need to redirect to a website. So for example, I have sites.google.com/xxx/xxx And when people enter that, I want it to redirect to my website

www.xxxxxxxx.com

How do I do this?

Answer

Tomáš František Kašpar picture Tomáš František Kašpar · Feb 13, 2020

You could bypass this by using js to change href of some hidden element and than use javascript to "click" on this element. I've used this to create contacts search element directly on sites.

Markup

<a href="" id="searchHelper"></a>
<button onclick="functionSearch()" id="buttonSearch"> 
<input type="text" id="inputSearch" value="" placeholder="Search">

Javascript

      function functionSearch() {
        var inputSearch = document.getElementById("inputSearch");
        if (inputSearch.value != "") {
            document.getElementById("searchHelper").href = "https://contacts.google.com/search/" + inputSearch.value;
            document.getElementById("searchHelper").click();
        }
      }