Skip to content

Instantly share code, notes, and snippets.

@annafergusson annafergusson/ Secret
Last active Oct 17, 2018

What would you like to do?
Random redirect using Google Apps Script
function doGet() {
var webpages = [];
//---------------just change the webpage URLs
//the webpages need to hosted on https sites - if you want more than two just create a new line using the same code as below
//just change the link to the google form
var random_page = Math.floor(Math.random()*webpages.length);
var redirect = webpages[random_page];
return HtmlService.createHtmlOutput("<script>location.href = '" + redirect + "';</script>");
//line below requires authorisation but also works - thanks Nikolai Cook
//return HtmlService.createHtmlOutput(UrlFetchApp.fetch(redirect));

This comment has been minimized.

Copy link
Owner Author

annafergusson commented Nov 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.