简体   繁体   中英

Redirect a href link to an external application

In a link in my web application it is possible to redirect to an external site and load as activated a specific bootstrap tab. This external site I do not have access to the source code.

In the site that I have access to the source code I can use something like this:

// trigger additional clicks
$ ('. tab-link') on ('click', function (event) {
     // Prevent url change
     event.preventDefault ();
    
     // `this` is the clicked <a> tag
     $ ('[data-toggle = "tab"] [trigger =' '+ this.hash +' "'').
})

Is it possible to do this without being able to put code on the site, just with the browser's address bar?

You can assign the location attribute on the window object to the url you want

// Sets the new location of the current window.
window.location = "https://www.example.com";

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