GM.openInTab: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
open_in_background verison note
Update for 4.0
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:GM_openInTab}}
== Description ==
== Description ==


This method opens the specified URL in a new tab.
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 ==
{{Function|GM.openInTab|url, open_in_background}}


{{Function|GM_openInTab|url, open_in_background}}
Compatibility: [[Version_history#4.0_2|Greasemonkey 4.0+]]


=== Arguments ===
=== Arguments ===
Line 17: Line 14:
: <code>String</code> The URL to navigate the new tab to.
: <code>String</code> The URL to navigate the new tab to.
; <code>open_in_background</code>
; <code>open_in_background</code>
: <code>Boolean</code> Optional: force tab to/to not open in a background tab.  Default (unspecified) behavior honors Firefox configuration. (As of [[Version_history#3.2|Greasemonkey 3.2]].)
: <code>Boolean</code> Optional: force tab to/to not open in a background tab.  Default (unspecified) behavior honors Firefox configuration.


== Returns ==
== Returns ==


Before version 0.8.2: <code>undefined</code>
<code>undefined</code>
As of [[Version_history#0.8.20090920.2|Greasemonkey 0.8.2]]: returns the <code>window</code> object created.
As of [[Version_history#3.0|Greasemonkey 3.0]]: <code>undefined</code>.


== Examples ==
== Examples ==


<pre class='sample'>
<pre class='sample'>
GM_openInTab("http://www.example.com/");
GM.openInTab("http://www.example.com/");
</pre>
</pre>


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

Latest revision as of 15:05, 3 November 2017

Description

This method opens the specified URL in a new tab.

Syntax

function GM.openInTab( url, open_in_background )

Compatibility: Greasemonkey 4.0+

Arguments

url
String The URL to navigate the new tab to.
open_in_background
Boolean Optional: force tab to/to not open in a background tab. Default (unspecified) behavior honors Firefox configuration.

Returns

undefined

Examples

GM.openInTab("http://www.example.com/");