+ 17

How to use window.location.href from Sololearn app version?

I was doing something which requires me to use URL of current code, so used window.location.href which works fine on the web version but it returns "about:blank" on app. Why is that Happening? Is there any way to fix it? https://code.sololearn.com/Winhn03SPyEd/?ref=app

22nd Dec 2019, 9:47 AM
Raj Chhatrala
Raj Chhatrala - avatar
14 Respuestas
+ 10
because the app is not a browser, it just use the webview api
22nd Dec 2019, 9:58 AM
Amethyst Animion
Amethyst Animion - avatar
+ 9
Amethyst Animion Ik, but is there anyway I can get url in app as well?
22nd Dec 2019, 10:03 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 7
🐼 Coding Panda 🐼 nope, i ever tried to get it long time ago and not found any way. The best way is to run the code on browser
22nd Dec 2019, 10:06 AM
Amethyst Animion
Amethyst Animion - avatar
22nd Dec 2019, 11:36 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 6
🐼 Coding Panda 🐼 What URL are you expecting? If you were on a browser visiting www.google.com, the location.href value refers to the URL of the remote web server. However, in the case of the running the code via the SoloLearn app, there is no remote server relative to the SL app. The client and the server are the same.
22nd Dec 2019, 4:49 PM
David Carroll
David Carroll - avatar
+ 5
It's not running in a server and neither in your filesystem. So, it's origin is null and location is about:blank
22nd Dec 2019, 5:39 PM
Sarthak
Sarthak - avatar
+ 3
I don't think we can retrieve url from webview, it's control on app level, unless Sololearn developer release this information from app coding of Sololearn app.
22nd Dec 2019, 12:23 PM
Calviղ
Calviղ - avatar
+ 2
It's not running in a server and neither in your filesystem. So, it's origin is null and location is about:blank. Exactly what i thought too.
23rd Dec 2019, 11:53 AM
Judith Azuma
Judith Azuma - avatar
0
because its different operating system between app and windows so you can't copy the URL
23rd Dec 2019, 12:02 PM
Rudy Mekeng
Rudy Mekeng - avatar
0
Nkanyane Rampai yea... here's your first tip: start using the app. 😏 2nd tip: dont thread hijack and respond to questions with appropriate answers.
26th Dec 2019, 9:41 PM
Mike
Mike - avatar
0
Добрый 6
21st Mar 2020, 8:11 AM
Dado Furs
- 2
Hola
23rd Dec 2019, 12:43 PM
José Ángel Soto castillon
José Ángel Soto castillon - avatar
- 4
Selam meraba
23rd Dec 2019, 9:19 AM
Arzu Arzu
- 4
I'm so new here and I really want to start learning ... Is there anyone who can offer some help?
23rd Dec 2019, 4:35 PM
Nkanyane Rampai