1

What i need to do:

page.com/index have a button, this button need to click Example from page.com/PageWhereThereIsExample

<li class="filter" data-filter=".color-1"><a href="#0" data-type="color-1">Example</a></li>

Is possible to "click" Example or something similar using URL?

Filter template: https://codyhouse.co/demo/content-filter/index.html

Keyon
  • 27
  • 2
  • 5

1 Answers1

0

HTML is stateless so if you want to click the button on index then have redirect to PageWhereThereIsExample with automatic click on Example you have to store the information that the button should be clicked somehow. You can store this information in the URL using GET parameter or HASH. But still on PageWhereThereIsExample you will have to check the URL and then simulate the "click" using JavaScript.

Index page link:

<a href="page.com/PageWhereThereIsExample#0">Example</a>

PageWhereThereIsExample filter item:

<li class="filter" data-filter=".color-1"><a href="#0" data-type="color-1">Example</a></li>

PageWhereThereIsExample JavaScript using jQuery:

$(document).ready(function() {
     var hash = window.location.hash;
     if (hash) {
          $('a[href="'+hash+'"]').click();
     }
});

Other interpretation of your question could be that you want to send a message between two browser pages/tabs. In this case I recommend looking at this question: Accessing the content of other tabs in browser.

Community
  • 1
  • 1
yunicz
  • 239
  • 2
  • 10