Javascript 以编程方式单击Gmail';s";“显示原件”;chrome扩展中的按钮?

Javascript 以编程方式单击Gmail';s";“显示原件”;chrome扩展中的按钮?,javascript,hyperlink,google-chrome-extension,gmail,Javascript,Hyperlink,Google Chrome Extension,Gmail,我似乎找不到在chrome扩展中以编程方式单击gmail的show original按钮的方法,源代码中似乎没有任何链接 但是,url与格式化电子邮件类似,可能可以构造,只是它有某种用户id,我无法获取: 普通邮件浏览: https://mail.google.com/mail/?shva=1#inbox/131bfc47a65cb2fe 显示原件: https://mail.google.com/mail/?ui=2&ik=8b4b18b93a&view=om&th=

我似乎找不到在chrome扩展中以编程方式单击gmail的show original按钮的方法,源代码中似乎没有任何链接

但是,url与格式化电子邮件类似,可能可以构造,只是它有某种用户id,我无法获取:

普通邮件浏览:

https://mail.google.com/mail/?shva=1#inbox/131bfc47a65cb2fe
显示原件:

https://mail.google.com/mail/?ui=2&ik=8b4b18b93a&view=om&th=131bfc47a65cb2fe
注意用户id
&ik=8b4b18b93a

有没有可能获得一个链接来显示原创

谢谢

当我在任何gmail页面上点击“查看页面源代码”时,我在
var GLOBALS=[…]数组中看到了这个键。我将使用从后台页面读取gmail页面源代码,然后使用正则表达式对其进行解析以找到该键


另一种方法是使用内容脚本将
标记注入gmail页面,然后使用将此
全局
数组传递回内容脚本(所有这些都是为了打破内容脚本沙箱)。

据我所知,
th=
仍然无法发现。URL将显示线程中第一条消息的ID,但不会显示其他消息的ID。
//Inject the following Script from contentScript to Page Script

//Allow firing an event [http://stackoverflow.com/questions/2381572/how-can-i-trigger-a-javascript-event-click]

function fireEvent(node, eventName) {
// Make sure we use the ownerDocument from the provided node to avoid cross-window //problems
var doc;
if (node.ownerDocument) {
    doc = node.ownerDocument;
} else if (node.nodeType == 9) {
    // the node may be the document itself, nodeType 9 = DOCUMENT_NODE
    doc = node;
} else {
    throw new Error("Invalid node passed to JSUtil.fireEvent: " + node.id);
}

if (node.fireEvent) {
    // IE-style
    var event = doc.createEventObject();
    event.synthetic = true; // allow detection of synthetic events
    node.fireEvent("on" + eventName, event);
} else if (node.dispatchEvent) {
    // Gecko-style approach is much more difficult.
    var eventClass = "";

    // Different events have different event classes.
    // If this switch statement can't map an eventName to an eventClass,
    // the event firing is going to fail.
    switch (eventName) {
        case "click":
            // Dispatching of 'click' appears to not work correctly in Safari. Use 'mousedown' or 'mouseup' instead.
        case "mousedown":
        case "mouseup":
            eventClass = "MouseEvents";
            break;

        case "focus":
        case "change":
        case "blur":
        case "select":
            eventClass = "HTMLEvents";
            break;

        default:
            throw "JSUtil.fireEvent: Couldn't find an event class for event '" + eventName + "'.";
            break;
    }
    var event = doc.createEvent(eventClass);
    var bubbles = eventName == "change" ? false : true;
    event.initEvent(eventName, bubbles, true); // All events created as bubbling and cancelable.

    event.synthetic = true; // allow detection of synthetic events
    node.dispatchEvent(event);
}
}

//Then select the element
var xx = document.query(showOriginalSelector);

//Fire mouseUp and mouseDown Events simultaneously
fireEvent(xx, 'mousedown');
fireEvent(xx, 'mouseup');