File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ as patterns:
210
210
.. code-block :: javascript
211
211
212
212
// URL is a built-in JavaScript class to manipulate URLs
213
- const url = new URL (' /.well-known/mercure' );
213
+ const url = new URL (' /.well-known/mercure' , window . origin );
214
214
url .searchParams .append (' topic' , ' http://example.com/books/1' );
215
215
// Subscribe to updates of several Book resources
216
216
url .searchParams .append (' topic' , ' http://example.com/books/2' );
@@ -286,7 +286,7 @@ and to subscribe to it:
286
286
const hubUrl = response .headers .get (' Link' ).match (/ <([^ >] + )>;\s + rel=(?:mercure| "[^ "] * mercure[^ "] * ")/ )[1 ];
287
287
288
288
// Append the topic(s) to subscribe as query parameter
289
- const hub = new URL (hubUrl);
289
+ const hub = new URL (hubUrl, window . origin );
290
290
hub .searchParams .append (' topic' , ' http://example.com/books/{id}' );
291
291
292
292
// Subscribe to updates
You can’t perform that action at this time.
0 commit comments