Outgoing links (different) from the site redirect to 1 link
There is a website. It has outbound links. They are redirected in this way
<input type="button" value="Перейти" onclick="window.open('http://сайт-на-который-происходит-редирект.tld/redir1.html');" class="button" />
...
redir2.html
redir3.html
I would like to quickly redirect all outgoing links to another 1 specific site address, for example, to Google.
To allow any click on the buttons with addresses
http://сайт-на-который-происходит-редирект.tld/redir1.html
redir2.html
redir3.html
Redirect for example to google
(without correcting outgoing links in the code) so that once everything is quickly returned as it was.
What method can I use to do this?, tell me?
Htaccess?
php?
0
1 answers
With jQuery, you can do this
$(function(){
var redirectToAdvertising = function() {
location.href = "http://google.com/";
return false;
}
//В нужный момент вешаем событие на клик по всем ссылкам на странице
$("a").on("click", redirectToAdvertising);
//В другой нужный момент - снимаем событие
$("a").off("click", redirectToAdvertising);
});
I'm too lazy to write on native JS, but it's not much more difficult there
1
Author: Andrey Makarov, 2016-04-18 15:06:47