Astrospheric offers an advanced web control which allows your users to get astronomy weather reports directly on your webpage. Use the Javascript API below to customize a personal control for your website.
Include the Astrospheric Embed API in the head section of your webpage.
<script type="text/javascript" src="https://astrosphericcloudstorage.blob.core.windows.net/embed/astrosphericembed.js" />
Create a container on your page to hold the control. A <div> in your markup will work the best. Modify the width style to work best for your page. Example:
<div id="AstrosphericContainer" style="width:640px;"></div>
Create the Astrospheric control in javascript using the Create API. Modify the Latitude and Longitude to set the forecast location. The container ID should match the id of the div you'd like the control to show up in. The Subspace API ID is optional for most all websites.
m_AstrosphericEmbed.Create(ContainerID, Latitude, Longitude);
Allow your users to change the forecast location using the javascript ChangeLocation API. Use this API instead of embedding multiple Astrospheric controls (which is not supported and will likely get your website blocked!)
m_AstrosphericEmbed.ChangeLocation(Latitude, Longitude);
Here is a simple HTML example to get you up and running
<html> <head> <title>Embed Test</title> <!--Astrospheric API Reference--> <script type="text/javascript" src="https://astrosphericcloudstorage.blob.core.windows.net/embed/astrosphericembed.js"></script> </head> <body> <!--Create a div for the Astrospheric Control to live in --> <div id="AstrosphericEmbedContainer"> </div> <!-- OPTIONAL - Create a button to change the control's location --> <button type="button" onclick="m_AstrosphericEmbed.ChangeLocation(48.399041, -58.589700);">Change location to Flat Bay</button> <!--Now setup the control with the Javascript API --> <script type="text/javascript"> // Initialize the control m_AstrosphericEmbed.Create("AstrosphericEmbedContainer", 47.609401, -122.325753); </script> </body> </html>
The Astrospheric embed control works in all modern browsers. Please note that Internet Explorer is no longer in active development by Microsoft and therefore not supported. However, Microsoft's new Edge browser is supported.
The control will automatically update four times a day. Do not embed the control on a webpage which auto-refreshes since it won't speed up how often new data is published, and will put unnecessary stress on the Astrospheric service.
Users will be able to animate the cloud map and click through the forecast hours to see details. Clicking on the map or on "Astrospheric.com" will load the full Astrospheric webpage for the user.
The embedded control will not show sponsor info.
Please note that this web control usage falls under the same Privacy and Terms of Use as the primary Astrospheric website.