Skip to content
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

do you think this can be solved ? #1

Open
minanagehsalalma opened this issue Jun 11, 2019 · 3 comments
Open

do you think this can be solved ? #1

minanagehsalalma opened this issue Jun 11, 2019 · 3 comments

Comments

@minanagehsalalma
Copy link

i want to access a local device page from another page (192.168.1.2) on the same network but that device page doesn't have remote access so i can't use your tool. .... and using extensions won't work cause i want to test it on chrome phones app .... and i can't edit that local device page code .
i want to make a login script that works what ever local CORS Anywhere server was available or not !!

any ideas ?
i think this may be the fix but how can i make it available at local and public at the same time ?!
here is the code that i want to use
c0a80101.c0a80102.rbndr.us is 192.168.1.1 and 192.168.1.2 combined .
i want at the first response the answer be 192.168.1.2 and then when the internet connection is back
i want the second response to be 192.168.1.1 and the code get's executed only if it received the second response correctly !!

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script> 
var http = new XMLHttpRequest();
var params = 'frashnum=&action=login&Frm_Logintoken="+results+"&Username=admin&Password=test';
var url = 'http://c0a80101.c0a80102.rbndr.us/';
http.open('POST', url, true);
//Send the proper header information along with the request
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 http.onload = function myfunction() {
let str = (http.responseText);
    alert(str)
    let pattern =/\bgetObj\("Frm_Logintoken"\)\.value = "([^"]+)";/;
    let results = console.log(str.match(pattern)[1]);
    return results;
    
 }; 
  var test = myfunction();
 document.write(test);
 http.send(params);
</script>
</body>
</html>
@netnr
Copy link
Owner

netnr commented Jun 11, 2019

The role played is to transit the request and assign the attributes of the header

Access-control-allow-origin: *
Access-control-expose-headers:

@minanagehsalalma
Copy link
Author

@netnr what do you mean but i am only using html and js !

@netnr
Copy link
Owner

netnr commented Jun 15, 2019

Transit request and add header cross-domain ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants