永远的异乡人 发表于 2022-10-28 17:21:21

油猴脚本能实现跨网站数据共享吗

就是在A网站有一个油猴脚本,它能够提取网页中的一些数据。从A跳转到B网站后,能不能自动把这些数据填写到网站B的输入框里。
网站A和B是跨域的,两者没有什么关联。仅仅是想把从网站A获取到的数据填入到网站B里。

李恒道 发表于 2022-10-28 17:54:41

gm_setvalue getvalue GM_addValueChangeListener可以跨页面通信
GM_setValue(name, value)
Set the value of 'name' to the storage.

GM_getValue(name, defaultValue)
Get the value of 'name' from storage.

GM_addValueChangeListener(name, function(name, old_value, new_value, remote) {})
Adds a change listener to the storage and returns the listener ID.
'name' is the name of the observed variable.
The 'remote' argument of the callback function shows whether this value was modified from the instance of another tab (true) or within this script instance (false).
Therefore this functionality can be used by scripts of different browser tabs to communicate with each other.
页: [1]
查看完整版本: 油猴脚本能实现跨网站数据共享吗