Click here to Skip to main content
15,861,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I got requirement where as I have simple HTML page with input type button. Onclick event of button I am navigating to another domain (URL). My requirement is I have hosted HTML page in one server (A) and on button click it is navigating to another server(B).

window.location.href="www.example.com"

In server B,in IIS they have restricted to read request only from server A. But when I click button from my local PC, request (IP Address) is going from my local PC with my local IP Adress Instead of server A IP Address because, button click is happening on client side.

Is there any way I can make server side post back (I don't have any languages like PHP, .NET, JAVA) I need to solve this using HTML/Java Script only.

Thanks for reading! Response would be appreciated.
Posted
Comments
Jacques Loubser 15-Jun-14 13:46pm    
Do I understand you correctly - You have a button on server A that when clicked, must navigate the user to Server B? Or is it that you want to POST data to Server B?
TechieDeveloper.Net 15-Jun-14 13:52pm    
Hi Jacques, You are right. I just want to navigate to Server B (which is www.example.com)

1 solution

I don't think that's possible in pure clientside javascript. You can't trick server B to see a third party PC as being server A. The only thing you can do is to put a "proxy" like feature on server A to access server B on behalf of the PC. So you either need to install and configure a genuine proxy or you need to write a small server side application for that. Of course, you can use javascript on server side too: see NodeJS[^].
 
Share this answer
 
Comments
TechieDeveloper.Net 18-Jun-14 6:36am    
I will try that.. Thanks for the response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900