Javascript Determine if page was opened by <a href> tag or window.location.href?

Viewed 52

The question is pretty much the same as the title.

Is there a way in Javascript to determine whether the page was opened by <a href> HTML tag or by window.location.href?

I need conditions for clearing saved states of data-table:

on reload

and

on opened via <a href> tag.

I don't want to clear saved states when opened via window.location.href.

I got one on reload:

if (performance.navigation.type == 1){
      var table = $('#categoryList').DataTable();
      table.state.clear();
      table.search("").draw(); 
      table.column( '0:visible' ).order( 'asc' ).draw();
      table.page.len(10).draw();
    }

I'm looking for another one on oponed via <a href>.

0 Answers
Related