Talk:GM.openInTab

From GreaseSpot Wiki
Revision as of 21:29, 30 December 2008 by Marti (talk | contribs) (Header GET results for window.open( "http://www.yahoo.com") and unsafeWindow.open( "http://www.yahoo.com") in a gm script.)
Jump to navigationJump to search

@Aavindraa

Shouldn't your note section example be unsafeWindow.open(url) instead of window.open(url)?

Marti 14:54, 30 December 2008 (EST)

Also GM_openInTab calls the root function of tabBrowser.addTab... so if it is truly not handling the referer, this is a Mozilla "by design" feature... not a Greasemonkey shortcoming. I've already confirmed the tab focus issue. Perhaps you should submit a feature enhancement ticket to have a return value of the tab, to be able to call the .focus() method.

Marti 15:03, 30 December 2008 (EST)


@Marti: I've tested, and window.open(url) works perfectly fine (with the referrer as I mentioned in the article). About GM_openInTab: I like the background feature, but the referrer has been an issue on some sites, so I'll add a ticket.--Aavindraa 15:12, 30 December 2008 (EST)


@Aavindraa

Hrmmm... just ran a test here and that's not the results I'm getting with the window object. (see http request below). The window object is also part of the XPCNativeWrapper and the last thing I would recommend is letting a website know that GM itself is actively redirecting to another site. Perhaps unsafeWindow is the answer you are looking for... I'll give it a shot momentarily and get back here.

GET / HTTP/1.1
Host: www.yahoo.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.0.5) Gecko/2008120121 Firefox/3.0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: *clipped*

Marti 16:03, 30 December 2008 (EST)

Tried unsafeWindow.open("http://www.yahoo.com") and it produces the same results... no referer atom.

This appears to be a natural function of Mozilla Firefox on this platform.

Marti 16:11, 30 December 2008 (EST)

Results from WinXP platform...

GET / HTTP/1.1
Host: www.yahoo.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: *clipped*

Again... no referer via window or unsafeWindow... this would strongly suggest that the browser is responsible. What platform are you running on?

Marti