We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a10900 commit 298e0adCopy full SHA for 298e0ad
ktor-http/js/src/io/ktor/http/URLBuilderJs.kt
@@ -16,10 +16,18 @@ import org.w3c.workers.*
16
*/
17
public actual val URLBuilder.Companion.origin: String
18
get() = when {
19
- PlatformUtils.IS_BROWSER -> if (js("typeof window !== 'undefined'") as Boolean) {
20
- window.location.origin
21
- } else {
22
- js("self.location.origin") as String
+ PlatformUtils.IS_BROWSER -> {
+ js(
+ """
+ var origin = ""
23
+ if (typeof window !== 'undefined') {
24
+ origin = window.location.origin
25
+ } else {
26
+ origin = self.location.origin
27
+ }
28
+ origin && origin != "null" ? origin : "http://localhost"
29
30
+ ) as String
31
}
32
else -> "http://localhost"
33
0 commit comments