javascript - Firefox 中的 gContextMenu.saveLink() 函数

标签 javascript firefox firefox-addon

有人知道上述函数的源代码吗?仅供引用,它是在 Firefox 浏览器中实现功能“将链接另存为..”的功能。

最佳答案

DXRMXR是您的 friend (除了获取代码;毕竟它是开源的)。

搜索 saveLink 后:

另外,在 a browser context scratchpad :

console.log(nsContextMenu.prototype.saveLink.toSource());

结果

"(function () {
    var doc =  this.target.ownerDocument;
    var linkText;
    // If selected text is found to match valid URL pattern.
    if (this.onPlainTextLink)
      linkText = this.focusedWindow.getSelection().toString().trim();
    else
      linkText = this.linkText();
    urlSecurityCheck(this.linkURL, this._unremotePrincipal(doc.nodePrincipal));

    this.saveHelper(this.linkURL, linkText, null, true, doc);
  })"

等等...(虽然,您需要知道 gContextMenunsContextMenu 的一个实例,您可以在 MXR 中找到它,.. .)

关于javascript - Firefox 中的 gContextMenu.saveLink() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24859458/

相关文章:

javascript - 左键单击链接不起作用,但 'Open in New Tab' 可以

javascript - HTML 属性中的 Vue.JS 数据

javascript - HTTP_ACCEPT_LANGUAGE 与 Linux 中 Firefox 中的 navigator.language 不同

java - 如何使用 Geckodriver 禁用 Firefox 登录 Selenium?

javascript - jquery animate scrollTop 无法在 FireFox 或 IE 上运行

firefox - 向 Firefox 扩展添加屏幕截图功能

Firefox 插件 : TypeError: getBrowserForTab(. ..) 未定义

javascript - 未捕获的类型错误 : Object [object Object] has no method 'colorpicker'

javascript - addEventListener ("load",...) 导致过多的 XmlHttpRequest?

javascript - 在 var 名称中使用 FOR 的 i = x