简体   繁体   English

如何防止浏览器在基于脚本的 Web 应用程序的应用程序 URL 中添加用户参数?

[英]How to Prevent Browser from Adding User Parameter in URL Of Apps Script Based Web App?

I have a web app functioning from the last two years but after updating some features and adding a new page I starting getting an error that Page not found.我有一个过去两年运行的网络应用程序,但在更新了一些功能并添加了一个新页面后,我开始收到一个错误,即找不到页面。 When I looked further I got to know it is because of User Parameter in the URL which can be seen in screenshots '/u/1' is being added in my script URL Automatically as click on a link.当我进一步查看时,我知道这是因为 URL 中的用户参数可以在屏幕截图中看到“/u/1”被自动添加到我的脚本 URL 中,因为单击链接。 I tried removing it manually but it doesn't help, I have tried several modes of deployment.我尝试手动删除它,但没有帮助,我尝试了多种部署模式。 And if I roll back to my older version it still works fine or if I log in only with a single account it works with the new version as well.如果我回滚到旧版本,它仍然可以正常工作,或者如果我只使用一个帐户登录,它也可以与新版本一起使用。 So I wanted some light is possible to overcome this issue?所以我想要一些光有可能克服这个问题吗? I am just a part-time coder who can create something based on my needs so even after looking for the whole day I couldn't get it working so as of now I have rolled back to the old version.我只是一个兼职编码员,可以根据我的需要创建一些东西,所以即使在寻找一整天之后我也无法让它工作,所以到目前为止我已经回滚到旧版本。

Thanks in advance I am more than happy to share any more info required.提前致谢,我非常乐意分享所需的更多信息。

Screenshots attached with URL difference and error.附有 URL 差异和错误的截图。 URL 中的用户参数错误

在此处输入图片说明

So I was able to find a workaround after roaming around in Google Forum as well they stated that it can not be solved since its intended behavior.因此,我在 Google 论坛中漫游后找到了解决方法,他们也表示由于其预期行为无法解决。 so what I did was done some modification in my function which was being used to get script URL and added some desired string to overcome user specific error when logged in with multiple users.所以我所做的是对我的函数进行了一些修改,该函数用于获取脚本 URL 并添加了一些所需的字符串以克服在多个用户登录时出现的特定于用户的错误。

Here is the code这是代码

function getScriptUrl() {
  var url = ScriptApp.getService().getUrl();
  var stringToBeChanged = 'macros/s';
  var newString = 'a/authentic.co.in/macros/s';
  url = url.replace(stringToBeChanged,newString);
  return url;
}

I hope this helps someone with a similar issue thank you for your support.我希望这对有类似问题的人有所帮助,谢谢您的支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 根据 Google Apps 脚本中的 URL 参数返回表格数据 / Web App - Return Sheets data based on URL Parameter in Google Apps Script / Web App 如何在 RASA 聊天机器人中从基于 web 浏览器的 java 脚本获取用户登录详细信息 - How to get the user login details from java script based web browser in RASA chatbot 如何防止浏览器在vanilla JavaScript中加载Web应用程序? - How to prevent the browser from loading a web app in vanilla JavaScript? 您如何检测并防止用户使用php / javascript从多个浏览器选项卡访问Web应用程序? - How do you detect and prevent a user from accessing a web app from multiple browser tabs using php/javascript? 使用Google Apps脚本使Web App适应浏览器的宽度 - Making Web App fit to browser width using Google Apps Script 如何从MyApp Android在Web浏览器应用程序中打开URL - How to open URL at web browser app from MyApp Android “如何在 javascript 中获取 google apps 脚本 web 应用沙箱的 url 查询字符串参数? - "How can I get the url query string parameters of a google apps script web app sandbox in javascript? 防止用户在浏览器中更改URL - Prevent user changing URL in browser 从Google应用程序脚本中的URL传递参数 - Passing parameter from URL in Google app script 防止用户在“后退”按钮上的浏览器中更改URL - Prevent user from changing the URL in Browser on Back Button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM