GM.openInTab: Difference between revisions
From GreaseSpot Wiki
Jump to navigationJump to search
m →Description: Sync with MDC terminology for last changeset. |
→Notes: add referrer issue |
||
Line 41: | Line 41: | ||
== Notes == | == Notes == | ||
=== Referrer Issue === | |||
Opening webpages by invoking this method may not be the ideal choice, because this method doesn't save the referring page, which makes webservers think that you are calling a page only by it's URL, and not from the webpage it was on. | |||
In the cases where it doesn't work, one may use <code>window.open(url)</code> instead, which is similar in that it opens a new tab, but it keeps the referrer and switches to the tab immediately. | |||
[[#top|top]] | [[#top|top]] | ||
[[Category:API_Reference|G]] | [[Category:API_Reference|G]] |
Revision as of 17:41, 30 December 2008
Description
This API method opens the specified URL in a new background tab.
Syntax
GM_openInTab( url )
- Value: Function
- Returns: Nothing
- Compatibility: Greasemonkey 0.5b+
Parameters Properties url
- All properties are optional except url.
Properties
url
- Value: String
- Usage:
url = "http://www.greasespot.net/";
Examples
GM_openInTab("http://www.greasespot.net/");
Notes
Referrer Issue
Opening webpages by invoking this method may not be the ideal choice, because this method doesn't save the referring page, which makes webservers think that you are calling a page only by it's URL, and not from the webpage it was on.
In the cases where it doesn't work, one may use window.open(url)
instead, which is similar in that it opens a new tab, but it keeps the referrer and switches to the tab immediately.