I'm required to build a website using the new google sites. I want to pass url query strings between pages. I'm exploring the class google.script.url a client side script.
How can I get this to work?
google.script.url.getLocation(function(location) {
console.log(location);
});
In my browser console I get the following error
Uncaught ReferenceError: google is not defined
What am I missing? How to reference google.script.url?
Thank you
Ok, I think you are mixing concepts because your tags say "google-sites-2016" and "google-apps-script", which are different Google services.
For Google sites, as it says HERE, you are not using the right service.
Now, if you want to use Apps Script as you may want for what I understood from your question. Follow these steps:
1) Go to this link
2) Click "New Project"
3) Paste this code in the script:
4) Go to File -> New -> HTML File
5) Paste this HTML :
6) Go to Publish -> Deploy as web app -> Deploy
7) You will get a link. Go to that link
Docs
You can find more info about it here:
Google Apps Script
Client-to-Server Communication