HtmlService.getUserAgent() is not available in V8 runtime of GAS

Asked 2 years ago, Updated 2 years ago, 93 views

V8 runtime is now available on the GAS.
https://developers.google.com/apps-script/guides/v8-runtime?hl=ja

However, when calling the HtmlService.getUserAgent() function, the legacy Rhino engine returned browser information in use, but the V8 engine seems to return null.
Is there any way to fix or avoid this?

function baz(){
  varfoo=HtmlService.getUserAgent();  
  Logger.log(foo);
  return1;
}

If you run the above code on the Rhino engine, V8 will display "null".

javascript google-apps-script ecmascript-6

2022-09-30 11:18

1 Answers

I don't know if it's a good thing, but I also asked questions in the English version and saw a temporary solution.

https://stackoverflow.com/questions/60146774/gas-htmlservice-getuseragent-returns-null-when-using-v8?noredirect=1#comment106391217_60146774

The summary was that the V8 did not seem to be able to use GAS's HtmlService.getUserAgent() yet, instead using the Navigator interface in client-side JavaScript.

https://developer.mozilla.org/ja/docs/Web/API/Navigator

It also worked on GAS WebApps to achieve its goal.

Also, I received a comment on Google's IssueTracker saying that I should vote, and I also voted for it.
https://issuetracker.google.com/issues/149247107

That's all.


2022-09-30 11:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.