-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RN 0.59.8: postMessage result from iOS WebView is double-encoded #25266
Comments
React Native's WebView was deprecated please migrate to Community version |
me too |
I had the same error with Expo SDK 33 and iOS. However, it shows error message as belows when I inject this code If you try this and solve, please notice me, too! |
me too |
改 OC原生可以避免它 |
|
I tried your method, but it still went wrong. |
I solve it with let string_data = m.nativeEvent.data;
if(Platform.OS === "ios"){
// IOS returns the data url encoded/percent-encoding twice
// unescape('%257B') -> %7B
// unescape(%7B) -> {
string_data = unescape(unescape(string_data));
} |
somehow adding seems the issue only affect UIWebView, not WKWebView |
it's working for me, thanks a lot! |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
The data returned to onMessage WebView callback on iOS is double-percent-encoded.
React Native version: 0.59.8
Steps To Reproduce
window.postMessage('https://test.com')
This was introduced in 61ca119#diff-17ddfccc3e39071c0aa51f82677e6d68 :
Correct method to use instead of
stringByReplacingPercentEscapesUsingEncoding
isstringByRemovingPercentEncoding
.cc @pvinis
The text was updated successfully, but these errors were encountered: