# HTML iframes: how can I jump to the beginning of the next page when clicking the next-Button?

**URL:** <https://forum.wixstudio.com/t/html-iframes-how-can-i-jump-to-the-beginning-of-the-next-page-when-clicking-the-next-button/58017>\
**Category:** Ask the community\
**Tags:** technical-talk, question\
**Created:** [April 11, 2024, 5:29pm UTC](https://forum.wixstudio.com/t/html-iframes-how-can-i-jump-to-the-beginning-of-the-next-page-when-clicking-the-next-button/58017 "2024-04-11T17:29:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user2006](https://avatars.discourse-cdn.com/v4/letter/u/a4c791/32.png) [@user2006](https://forum.wixstudio.com/u/user2006)\
**Post date:** [April 11, 2024, 5:29pm UTC](https://forum.wixstudio.com/t/html-iframes-how-can-i-jump-to-the-beginning-of-the-next-page-when-clicking-the-next-button/58017/1 "2024-04-11T17:29:48Z")

</div>

**Question:**  
[Hi Iam using iframes HTML. How can I command that when I click on the Next-button, I jump to the beginning of the next page?]

**Product:**  
[HTML iframes]

---

<div class="post-metadata">

**Author:** ![Rob\_Soto](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@Rob\_Soto](https://forum.wixstudio.com/u/Rob_Soto)\
**Post date:** [April 11, 2024, 7:28pm UTC](https://forum.wixstudio.com/t/html-iframes-how-can-i-jump-to-the-beginning-of-the-next-page-when-clicking-the-next-button/58017/2 "2024-04-11T19:28:44Z")

</div>

Assuming the button you want to press is in your iFrame

On your iFrame button press call:

```javascript
// If you need to send any data with it 
const jsonString = JSON.stringify(json);
window.parent.postMessage(jsonString, "http://mysite.com");

```

On your page with the iFrame:

```javascript
import wixLocationFrontend from 'wix-location-frontend';

$w.onReady(async function () {
	// Replace with name of your i-frame
	$w("#your_iframe").onMessage( (event) => {
                  // Grab any data you need from the i-frame (if necessary)
    	          const jsonData = JSON.parse(event.data);
                  // Go to the next page (set page name in Settings -> SEO Basics -> URL Slug)
                  wixLocationFrontend.to("/goToPageName");
	});
});

```

Some more info on going to the next page:

> **[to - Velo API Reference - Wix.com](https://www.wix.com/velo/reference/wix-location-frontend/to)**
>
> Directs the browser to navigate to the specified URL. The to() function navigates the browser to another web page. The to() function can only be used when ...

More info for communicating between iFrame and page:

> **[onMessage - Velo API Reference - Wix.com](https://www.wix.com/velo/reference/$w/htmlcomponent/onmessage)**
>
> Adds an event handler that runs when the HTML Component sends a message. The onMessage() function allows your page code to receive messages from an HTML ...
