# Change URL when clicked

**URL:** https://community.weweb.io/t/change-url-when-clicked/959
**Category:** How do I?
**Created:** [August 9, 2022, 8:15pm UTC](https://community.weweb.io/t/change-url-when-clicked/959 "2022-08-09T20:15:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![khairul](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@khairul](https://community.weweb.io/u/khairul)
#### Post date: [August 9, 2022, 8:15pm UTC](https://community.weweb.io/t/change-url-when-clicked/959/1 "2022-08-09T20:15:59Z")

</div>

Hi, is it possible to change the URL when a button is clicked and popup is displayed, without redirect? Like instagram web.

If possible how can I do it?

---

<div class="post-metadata">

### Author: ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)
#### Post date: [August 16, 2022, 3:01pm UTC](https://community.weweb.io/t/change-url-when-clicked/959/2 "2022-08-16T15:01:01Z")

</div>

Hi, yes it possible because WeWeb is SPA

To do that with WeWeb, you need to create one page with your content and your button in one section. You create a second page with exactly the same content and button as an instance. After that, you add your popup to the second page. Finally, on the first page, you add an event on your button to change the page and go to the second page. And because WeWeb is an SPA, it won’t reload all the content and only add your popup and change the URL 🙂

If you need more information to understand, don’t hesitate to read this documentation about SPA: [SPA (Single-page application) - MDN Web Docs Glossary: Definitions of Web-related terms | MDN](https://developer.mozilla.org/en-US/docs/Glossary/SPA)

---

<div class="post-metadata">

### Author: ![khairul](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@khairul](https://community.weweb.io/u/khairul)
#### Post date: [August 16, 2022, 3:05pm UTC](https://community.weweb.io/t/change-url-when-clicked/959/3 "2022-08-16T15:05:11Z")

</div>

Thanks so much @Mael I did that and very cool.

However I still can’t figure out how to replicate like instagram. Where when you clicked an image it opens a popup and change the link, and you can go back to previous page where you left off,

 ![Screenshot 2022-08-16 at 11.02.35 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/77a5afb1c6b87f7309742ddd95ae856dea4b1d35.jpeg)

But if you go to the link or refresh, it opens a different layout(the background is removed, and another component exist).

 ![Screenshot 2022-08-16 at 11.02.50 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/ecb6b7f8582aece6dd2e04d975ece3a4ad9f5af4.jpeg)

How can I replicate that?

---

<div class="post-metadata">

### Author: ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)
#### Post date: [August 18, 2022, 7:19am UTC](https://community.weweb.io/t/change-url-when-clicked/959/4 "2022-08-18T07:19:10Z")

</div>

I think the best way to do that is to use a global workflow.

You can use a variable firstPageId, and two layouts for your page. The layout is different if the variable is your page with all your picture or if it’s a refresh

---

<div class="post-metadata">

### Author: ![khairul](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@khairul](https://community.weweb.io/u/khairul)
#### Post date: [August 18, 2022, 9:31am UTC](https://community.weweb.io/t/change-url-when-clicked/959/5 "2022-08-18T09:31:53Z")

</div>

Thank you I will try that

---

<div class="post-metadata">

### Author: ![se.belobrov](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@se.belobrov](https://community.weweb.io/u/se.belobrov)
#### Post date: [December 28, 2024, 12:40am UTC](https://community.weweb.io/t/change-url-when-clicked/959/6 "2024-12-28T00:40:22Z")

</div>

> [@Mael](#):
>
> I think the best way to do that is to use a global workflow.
> 
> You can use a variable firstPageId, and two layouts for your page. The layout is different if the variable is your page with all your picture or if it’s a refresh

But how then to bind a variable with a page path?
