Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

How to Fetch a Website After User Login in React Native

$
0
0

So i am trying to fetch a div from my university campus system website to show in my React Native App but whatever i try i can't able to do it.

Lets say my campus system's login page in the link of campus.com/login . The user has to login with their credentials to get to the main page of the system. Then user has to click a button to go campus.com/program. When the user in the campus.com/program i need to fetch a div from this page. I can't directly go to campus.com/program because it is automatically redirects to login page.

Here are what i tried so far:

1- I tried using react-native-inappbrowser-reborn i couldn't found any method to track where the users in the browser.

2- I tried react-native-webview with the following code:

const jsCode = "window.postMessage(document.getElementsByTagName('body').innerHTML)";
<WebView
               javaScriptEnabled={true}
               injectedJavaScript={jsCode}
               source={{uri: 'https://campus.com/login'}}
               onMessage={event =>
                 console.log(event)
               }
             />

This doesn't work either. Nothing returns with the injected javascript.

3- I try to use the onnavigationstatechange with WebView but it doesn't work because login and program page is in the same domain.

Is there any method to use for this situation? Do anyone can help please?


Viewing all articles
Browse latest Browse all 138192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>