Skip to content

Commit 7fda84a

Browse files
committed
adding note about p5 editor to getURL methods closes #5035
1 parent d4aec1a commit 7fda84a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/core/environment.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,10 @@ function exitFullscreen() {
657657
}
658658

659659
/**
660-
* Gets the current URL.
660+
* Gets the current URL. Note: when using the
661+
* p5 Editor, this will return an empty object because the sketch
662+
* is embedded in an iframe. It will work correctly if you view the
663+
* sketch using sketch the edtior's present or share URLs.
661664
* @method getURL
662665
* @return {String} url
663666
* @example
@@ -685,7 +688,10 @@ function exitFullscreen() {
685688
*/
686689
p5.prototype.getURL = () => location.href;
687690
/**
688-
* Gets the current URL path as an array.
691+
* Gets the current URL path as an array. Note: when using the
692+
* p5 Editor, this will return an empty object because the sketch
693+
* is embedded in an iframe. It will work correctly if you view the
694+
* sketch using sketch the edtior's present or share URLs.
689695
* @method getURLPath
690696
* @return {String[]} path components
691697
* @example
@@ -704,7 +710,10 @@ p5.prototype.getURL = () => location.href;
704710
p5.prototype.getURLPath = () =>
705711
location.pathname.split('/').filter(v => v !== '');
706712
/**
707-
* Gets the current URL params as an Object.
713+
* Gets the current URL params as an Object. Note: when using the
714+
* p5 Editor, this will return an empty object because the sketch
715+
* is embedded in an iframe. It will work correctly if you view the
716+
* sketch using sketch the edtior's present or share URLs.
708717
* @method getURLParams
709718
* @return {Object} URL params
710719
* @example

0 commit comments

Comments
 (0)