众所周知,如何制作自定义上方菜单项(https://developers.google.com/apps-script/guides/menus),但右键单击单元格或项目时是否可以在上下文菜单中附加功能?
“ www.mysite.com/mySecretKey1”重定向到“ www.othersite.com/mySecretKey2”
在G.AppsScript中:
var response = UrlFetchApp.fetch("https://www.mysite.com/mySecretKey1");
var headerString = response.getAllHeaders().toSource();
Logger.log(headerString);
//string 'www.othersite.com.my/SecretKey2' is not present in log.
Run Code Online (Sandbox Code Playgroud)
脚本将如何发现重定向到的URL地址(即字符串'www.othersite.com/mySecretKey2')?
更新:更一般而言,脚本将如何从中发现URL地址response?
在vis.js中定义节点,http://visjs.org/network_examples.html,如下所示:
var nodes = [
{id: 1, label: 'Node1'},
{id: 2, label: 'Node2'},
{id: 3, label: 'Node3'},
{id: 4, label: 'Node4'}
];
Run Code Online (Sandbox Code Playgroud)
我想要找出的是,你可以创建一个节点双击(或其他事件/点击类型)动作,如下所示:
var nodes = [
{id: 1, label: 'Node1', double-click: 'Arbitrary_OnClick_Function()'},
{id: 2, label: 'Node2', double-click: 'document.getElementById("div1").innerHTML="Node 2 was clicked"'},
{id: 3, label: 'Node3', double-click: 'https://www.google.com;target="_blank"'},
{id: 4, label: 'Node4', double-click: '#SomePageSection'}
];
Run Code Online (Sandbox Code Playgroud)
也许有一种方法可以结合angular.js(github.com/edgaraafelix/angular-visgraph)或非简单地通过vis.js方法on(event,callback)(http//visjs.org/docs/network.html#Methods和http://visjs.org/docs/network.html#Events) .