简体   繁体   中英

Replace browser url "http://172.20.30.1:8080" to "http://172.20.30.15:8180" without redirect, using javascript when ajax call return response

I want to connect from app A with address " http://172.20.30.15:8180 " to app 2 with address " http://172.20.40.15:8080 " that have security OAuth2 and my browser is Firefox. I use ajax for connecting with head "Bearer token". Pls help me how can display home app B From app A?

When I use pushstate I catch error, "

ecurityError: The operation is insecure"

You can use history.pushState on ajax success .

Eg:

$.ajax({
    url: "YourURL",
    type: "POST",
    data: "DataIfYouPAss",
    success: function(data) {
        window.history.pushState("YourDetails", "YourTitle", "http://172.20.30.15:8180");
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM