I have a JS script that appends to the HTML page the pairs: input + anchor
Can I compute the URL before the redirect happens?
Now I have link that looks like this:
<a href="#" onclick="myFunct();return false;">link</a>
and myFunct uses window.location.href to redirect webpage. The problem with this approach is that I cannot (obviously) CTRL+click on the link for opening goal link in a new tab.
Details:
-
The link URL is known after obtaining the URL from the server – this operation is very expensive for me and I would like to do that only in case it is absolutely necessary.
-
The idea is: user chooses a link, he/she clicks it, url is obtained from server and user is redirected (in the same window or in a new tab if he/she uses CTRL+click)
Thanks!
I solved my issue with pre-computing the link and optimizing the code to make the overhead as low as possible.