JSFiddle - React, Tailwind, and code Playground

by igalst

HTML

<script>	window.addEventListener('message', function(event) {
		window.parent.postMessage(event.data, '*');
	});
</script>

<script>
	window.addEventListener('message', function(event) {
		var data = event.data || {};
		
		var scope = data.scope;
		var action = data.action;
		var value = data.value;

		if (scope !== 'history') return;

		history[action](
			value.state || {},
			value.title || '',
			value.url
		);
	});
</script>

JavaScript

const $pubSub = $w('#pubSub');

	$pubSub.postMessage({
		scope: 'history',
		action: 'replaceState',
		value: { url: getUrl() }
	});