Difference between revisions of "P5js open URL"
From Digipool-Wiki
(→Open URL in a new Tab) |
|||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
<pre> | <pre> | ||
− | window.location.href = 'https://www. | + | window.location.href = 'https://www.my-url.com'; |
</pre> | </pre> | ||
− | |||
== Open URL in a new Tab == | == Open URL in a new Tab == | ||
<pre> | <pre> | ||
− | window.open(url, '_blank').focus(); | + | window.open('https://www.my-url.com', '_blank').focus(); |
</pre> | </pre> | ||
Line 20: | Line 19: | ||
<pre> | <pre> | ||
function setup() { | function setup() { | ||
− | myLink = createA('https:// | + | myLink = createA('https://www.my-url.com', 'www.my-url.com'); |
myLink.position(30, 30); | myLink.position(30, 30); | ||
myLink.style('font-size', 24 + 'px'); | myLink.style('font-size', 24 + 'px'); |
Latest revision as of 19:27, 18 March 2024
Go to URL
window.location.href = 'https://www.my-url.com';
Open URL in a new Tab
window.open('https://www.my-url.com', '_blank').focus();
Open URL via Text Link
function setup() { myLink = createA('https://www.my-url.com', 'www.my-url.com'); myLink.position(30, 30); myLink.style('font-size', 24 + 'px'); myLink.hide(); myLink.show(); }