Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Problems opening long URL
Started by leif.helge Jan 25 2020 02:22 AM

2 replies to this topic
ios system.openurl
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

leif.helge

[GLOBAL: userInfoPane.html]
leif.helge
  • Observer

  • 9 posts
  • Corona SDK

My app shall open a rather long URL using system.openURL(). There are no problems whatsoever on Android, but on iOS it fails.

 

I have tried to shorten the URL, then its OK. How can I solve this? The URL in question is e.g. 

 

https://kart.gulesider.no/?c=59.941428,11.031561&z=14&d={%22m%22:[[59.941686,11.02169,null,0],[59.944609,11.048555,null,0]]}

 

It opens OK directly in Safari, but not from the app. Any help highly appreciated.



[TOPIC: post.html]
#2

leif.helge

[GLOBAL: userInfoPane.html]
leif.helge
  • Observer

  • 9 posts
  • Corona SDK

Found the solution myself. An URL containing special characters like { [ ] } is not accepted by Safari (when parsed from Corona). These special characters must be replaced by

 

{ - %7B

[ - %5B

] - %5D

} - %7D

 

For other characters please refer to https://www.w3schools.com/tags/ref_urlencode.ASP, URL Encoding Functions.

 

Android  is satisfied with both formats, so no need to make separat URL's depending on target OS.



[TOPIC: post.html]
#3

pixec

[GLOBAL: userInfoPane.html]
pixec
  • Contributor

  • 170 posts
  • Corona SDK

Why not use base64 for urls?


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: ios, system.openurl