Microsoft Edge is constantly evolving, bringing new and exciting web platform features to developers. But how can you safely test and experiment with these cutting-edge APIs on your live website without impacting your users? The answer lies in Origin Trials.
This article provides a comprehensive guide to understanding and utilizing Origin Trials in Microsoft Edge, enabling you to explore experimental features and provide valuable feedback to browser engineers and the web standards community.
Origin Trials provide a mechanism to safely experiment with new and experimental APIs on your live website for a limited period. Think of them as a sandbox environment for specific features. When a Microsoft Edge user visits your site with a valid Origin Trial token, their browser can execute code that utilizes these experimental APIs. This allows you to:
To see a list of available origin trials and register your origin, visit the Microsoft Edge Origin Trials page.
The core of the Origin Trial system is the token. This unique identifier acts as a key, unlocking the experimental feature for users visiting your site. Here's how it works:
Registration: You register your origin (domain or subdomain) for a specific Origin Trial through the Microsoft Edge Origin Trials portal.
Token Generation: Upon successful registration, a unique token is generated specifically for your origin and the chosen trial.
Token Implementation: You embed the token into your website using one of two methods:
HTML Meta Tag: Add the following meta tag within the <head>
section of your webpage:
<meta http-equiv="origin-trial" content="YOUR_TOKEN_HERE">
HTTP Header: Include the following HTTP header in your server response:
Origin-Trial: YOUR_TOKEN_HERE
Feature Activation: When a Microsoft Edge user visits your webpage, the browser detects the Origin Trial token and automatically enables the corresponding feature flag.
Key Considerations:
Users don't need to manually enable flags in edge://flags
. The token handles it automatically.
Trailing paths and query parameters in the domain URL during registration are ignored. Only the root domain or subdomain is registered.
You can configure the token to be valid for:
https://example.com
) without subdomains.https://beta.example.com
).https://example.com
or https://beta.example.com
).<meta>
tag or HTTP header.localhost
: Origin Trials rely on SSL-enabled domains and do not work directly on localhost
. To test locally, you'll need to enable the corresponding feature flag in edge://flags
.Origin Trials have a planned expiration date, which is displayed on the trial's information card. After this date, the token will no longer be valid.
However, a Microsoft Edge feature team can end an experiment early due to reasons such as:
In case of early termination, the feature team will notify all enrolled developers.
Your feedback is crucial to the success of Origin Trials. Share your experiences, use cases, and API design suggestions through the Issues tab of the feature's GitHub repository.
Origin Trials are a powerful tool for web developers looking to explore the future of the web. By participating in these trials, you gain early access to innovative features, contribute to their development, and position yourself at the forefront of web technology. So, dive in, experiment, and help shape the future of Microsoft Edge!