GM.openInTab: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
(Update for 4.0)
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{underscore|title=GM_openInTab}}
__NOTOC__
== Description ==
== Description ==


This [[API_reference|API]] method opens the specified URL in a new tab.
This method opens the specified URL in a new tab.
 
[[#Examples|Examples]] | [[#Notes|Notes]]


== Syntax ==
== Syntax ==


'''GM_openInTab(''' ''url'' ''')'''
{{Function|GM.openInTab|url, open_in_background}}


:Value: Function
Compatibility: [[Version_history#4.0_2|Greasemonkey 4.0+]]
:Returns: Nothing
:Compatibility: [[Version_history#0.5_beta|Greasemonkey 0.5b+]]


:{| border="1" cellpadding="5"
=== Arguments ===
|+ Parameters
!|'''Properties'''
|-
| <code>[[#url |url]]</code>
|}
:* All properties are optional except [[#url|url]].


[[#Description|top]]
; <code>url</code>
=== Properties ===
: <code>String</code> The URL to navigate the new tab to.
----
; <code>open_in_background</code>
==== <code>url</code> ====
: <code>Boolean</code> Optional: force tab to/to not open in a background tab.  Default (unspecified) behavior honors Firefox configuration.
:Value: String
:Usage: <code>'''url''' = "<nowiki>http://www.greasespot.net/</nowiki>";</code>


[[#Description|top]] | [[#Syntax|back]]''
== Returns ==


= Examples =
<code>undefined</code>
<code><pre>
GM_openInTab("http://www.greasespot.net/");
</pre></code>


[[#Description|top]]
== Examples ==


= Notes =
<pre class='sample'>
[[#Description|top]]
GM.openInTab("http://www.example.com/");
</pre>


[[Category:API_Reference|G]]
[[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/");