Skip to content

Dispatch custom event when user accepts the policy#245

Open
codereviewvideos wants to merge 1 commit intotrewknowledge:developfrom
codereviewvideos:patch-2
Open

Dispatch custom event when user accepts the policy#245
codereviewvideos wants to merge 1 commit intotrewknowledge:developfrom
codereviewvideos:patch-2

Conversation

@codereviewvideos
Copy link

Dispatch a custom event so we can do "interesting things" from elsewhere when the user accepts the policy.

In my example I want to redirect the user to the same page, but with a cache buster on the end of the URL:

jQuery( document )
	.on(
		"updatedPrivacyPreferences",
		function() {
			"use strict";

			var current_url = encodeURI( window.location.href );
			var qs_concat = current_url.indexOf( "?" ) > -1 ? "&" : "?";

			window.location = encodeURI( current_url + qs_concat + "ts=" + new Date().getTime() );
		}
	);

Dispatch a custom event so we can do "interesting things" from elsewhere when the user accepts the policy. 

In my example I want to redirect the user to the same page, but with a cache buster on the end of the URL:

```
jQuery( document )
	.on(
		"updatedPrivacyPreferences",
		function() {
			"use strict";

			var current_url = encodeURI( window.location.href );
			var qs_concat = current_url.indexOf( "?" ) > -1 ? "&" : "?";

			window.location = encodeURI( current_url + qs_concat + "ts=" + new Date().getTime() );
		}
	);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant