GM.openInTab: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m Text replace - "</pre>}}" to "</pre>"
simplify
Line 3: Line 3:
== Description ==
== Description ==


This [[API_reference|API]] method opens the specified URL in a new background tab. Foreground loading may be globally overridden by setting the Mozilla preference <code>browser.tabs.loadInBackground</code> to <code>false</code> in [http://kb.mozillazine.org/About:config about:config].
This method opens the specified URL in a new tab.
As of [[Version history#0.8.20090920.2|Greasemonkey 0.8.2]] it obeys the built in "When I open a link in a new tab, switch to it immediately" preference (<code>browser.tabs.loadInBackground</code>).
 
Compatibility: [[Version_history#0.5_beta|Greasemonkey 0.5b+]]


== Syntax ==
== Syntax ==


'''GM_openInTab(''' ''url'' ''')'''
{{Function|GM_openInTab|url}}


:Value: Function
=== Arguments ===
:Returns: undefined
:Compatibility: [[Version_history#0.5_beta|Greasemonkey 0.5b+]]


:{| cellpadding="5" style="border-style:solid; background:#FFFFE0;"
; <code>url</code>
|+ Parameters
: <code>String</code> The URL to navigate the new tab to.
!style="background:#CC9900;"|'''Properties'''
|-
| <code><span style="background:#FFFFE0;">[[#url |url]]</span></code>
|}
:* All properties are optional except [[#url|url]].


=== Properties ===
== Returns ==
----
==== <code>url</code> ====
:Value: String
:Usage: <code>'''url''' = "<nowiki>http://www.greasespot.net/</nowiki>";</code>


<code>undefined</code>


== Examples ==
== Examples ==
<pre class='sample'>
<pre class='sample'>
GM_openInTab("http://www.greasespot.net/");
GM_openInTab("http://www.example.com/");
</pre>
</pre>


[[Category:API_Reference|O]]
[[Category:API_Reference|O]]

Revision as of 22:44, 8 February 2010


Description

This method opens the specified URL in a new tab. As of Greasemonkey 0.8.2 it obeys the built in "When I open a link in a new tab, switch to it immediately" preference (browser.tabs.loadInBackground).

Compatibility: Greasemonkey 0.5b+

Syntax

function GM_openInTab( url )

Arguments

url
String The URL to navigate the new tab to.

Returns

undefined

Examples

GM_openInTab("http://www.example.com/");