3

i have a website, and i am sure i can open it in PC browser, or mobile browser, util i use React-Native Android Webview Component .

the WebView Component, i can use it open some url ,such as m.facebook.com, but could not open my website, do not know why, i have set some props of WebView ,such as automaticallyAdjustContentInsets ,javaScriptEnabled,domStorageEnabled,scalesPageToFit.

when i use the FB example UIExplorer, it good work for open m.facebook.com, but when i change the url to my website, could not open it.

anyone know how is it ?

And when i use WebView Component and get into trouble, how can i debug it?

2
  • 1
    I am also facing the same problem... Did you got the solution? Commented Mar 9, 2016 at 10:30
  • I am also facing this error when data come from api and some api data url open or some can't you got solution in react native?? Commented Dec 15, 2022 at 11:01

1 Answer 1

0

yep, i know how is it,

the reason is my html page height is 0

when i find the answer of this question, another one meet the same question, he finally find the reason is his html page height is 0, he can debug his app with chrome inspcet, but i can not.

so, the first thing i should do is try to debug my app, after a long time ,i dubug it successful and he is right ,the reason is no height for html body, and then it is easy to reslove like this,add this line of code to my html page when it is load:

$(html).height($(window).height())

but, after a second , i find it is invalid in some android phone, i will get:

$(window).height() == 0; // true

then, i change the line to:

if($(window).height()!==0) {
    $(html).height($(window).height());
} else {
    $(html).height(10000);
}

it is a fast way to fix it, and the page is correct.

in the end ,i am confuse of the height, i am sure the page can be open in mobile browser, why the height become 0 in react-native WebView?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.