2

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?

Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64
Jay M.
  • 41
  • 1
  • 1
  • 3

2 Answers2

1

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();
        }
      }
-1

On App Script it's not possible.

In App Script , you can do this:

 var anchor = app.createAnchor("link", "http://www.google.com");

Look the doc : => https://developers.google.com/apps-script/reference/ui/anchor

On javascript :

//  click on a link
window.location.href = "http://google.com";
// redirect
window.location.replace("http://google.com");
Hann
  • 727
  • 3
  • 11
  • 22