Conversion Guide

PubChem has announced a new version of widgets, PubChem Widgets v2.0f. If you have embedded in your web pages the widgets that were previously referred to as table-based widgets, or classification widgets, please follow the examples below to learn the difference and how to convert to use PubChem Widgets v2.0f. There is no change regarding autocomplete widgets in PubChem Widgets v2.0f

 

For more information on PubChem Widgets v2.0f, please click here. For document of PubChem Widgets v1.0beta, please click here.

 

 

Table-based widgets (such as patents available for a given compound), and the classification widgets (such as classification annotated for a given compound) of PubChem Widgets v1.0beta are now included in the data view widgets of PubChem Widgets v2.0f. Embedding data view widgets of Widgets v2.0f in to your web pages is simple. All you need is to include a HTML iframe tag with proper src for each widget, as well as the open source iframe resizer, in your web page.

 

Example: Convert previous table-based widgets: the table of patents of CID 2244

  • Displayed in PubChem Widgets v1.0beta:

     

  • Displayed in PubChem Widgets v2.0f:

     

  • Convert to PubChem Widgets v2.0f:
    1. Remove all scripts and code snippets needed for old widget.
    2. Add the following iframe to your page at the location where you want the widget to appear:
      <iframe class="pubchem-widget" src="https://pubchem.ncbi.nlm.nih.gov/bioassay/aspirin#section=Depositor-Supplied-Patent-Identifiers&embed=true" style="border: 0;  width: 100%; height: 650px;"></iframe>
    3. To resize your iframe automatically, add the iframe resizer to your page (only once, even if you have multiple pubchem widgets on the page) just before the closing body tag:
      <script type="text/javascript" src="https://pubchem.ncbi.nlm.nih.gov/pcfe/libs/iframeResizer.min.js"></script>
      <script type="text/javascript">iFrameResize({log:false,checkOrigin:false}, '.pubchem-widget')</script>

 

 

Example: Convert previous classification widgets: the classification annotated on CID 2244

  • Displayed in PubChem Widgets v1.0beta:
  •  

  • Displayed in PubChem Widgets v2.0f:
  •  

  • Convert to PubChem Widgets v2.0f:
    1. Remove all scripts and code snippets needed for old widget.
    2. Add the following iframe to your page at the location where you want the widget to appear:
      <iframe class="pubchem-widget" src="https://pubchem.ncbi.nlm.nih.gov/bioassay/aspirin#section=KEGG--ATC&embed=true" style="border: 0;  width: 100%; height: 1200px;"></iframe>
    3. To resize your iframe automatically, add the iframe resizer to your page (only once, even if you have multiple pubchem widgets on the page) just before the closing body tag:
      <script type="text/javascript"> src="https://pubchem.ncbi.nlm.nih.gov/pcfe/libs/iframeResizer.min.js"></scripts>
      <script type="text/javascript">iFrameResize({log:false,checkOrigin:false}, '.pubchem-widget')</scripts>