E
E
Evgeny Shevtsov2015-11-05 19:05:55
JavaScript
Evgeny Shevtsov, 2015-11-05 19:05:55

How to open a link in the same window?

This code opens the link in a new window

<script>$('.hidden-link').click(function(){window.open($(this).data('link'));return false;});</script>

How to rewrite it to open in the current window.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Shevtsov, 2015-11-05
@Rattlesneyk

<script>$('.hidden-link').click(function(){window.location.href=$(this).data('link');return false;});</script>

D
Denis Bukreev, 2015-11-05
@denisbookreev

instead of any bullshit, do this:
and if it’s completely unbearable, then add:
$('.hidden-link').click();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question