如果我将其加载到新选项卡(FF3)中,它可以工作。如果我将它加载到当前选项卡中,它只会打印 url。
我认为实际上是将其加载到现有的 gmail 选项卡中的问题。比如说,制作小书签,单击一次,然后再次单击。这似乎是重现问题的方法。
知道什么会导致这种情况吗?我可以想到一些解决方法,但我很好奇它是如何工作的。
javascript:var%20t=new%20Date(),y=t.getFullYear(),m=t.getMonth()+1,d=t.getDate();document.location.href="http://mail.google.com/mail/#search/is%3Aunread+after%3A"+y+"-"+m+"-"+d
/* same code split up for readability */
javascript:
var t = new Date(),
y = t.getFullYear(),
m = t.getMonth()+1,
/* d = t.getDay(); I actually have this correct above, but not here.. oops */
d = t.getDate();
document.location.href="http://mail.google.com/mail/#search/is%3Aunread+after%3A"+y+"-"+m+"-"+d;
有什么帮助吗?
谢谢 :)
更新:
当我从这个答案中删除多余的空格并将必要的空格转换为“%20”(url编码)时,它什么都不做:
/* this works. I was missing the final ")" altCognito wrote */
javascript:void((function(){var%20t=%20new%20Date(),y=t.getFullYear(),m=t.getMonth()+1,d=t.getDate();window.location.href="http://mail.google.com/mail/#search/is%3Aunread+after%3A"+y+"-"+m+"-"+d;})())
我还尝试了一些分号摆弄和其他一般语法检查,但我不确定我在寻找什么。它既不能用作书签,也不能直接粘贴到地址栏中(无论如何对我来说)。