Forums

Dynamically create embeddable iframe for game

Sort:
astley92

G'day everyone.

I'm putting together a website and I'd like to use the embeddable iframe share option that chess.com offers to display certain games. But, I'd prefer to do this programmatically. I get the latest games for relevant players daily already and store most of the returned JSON in a DB, but cannot find anything about generating or retrieving that embeddable iframe html.

Has anyone done this in the past or know a good place to start? I know I could always use a PGN viewer as I already save the PGN, but chess.com's iframe is basically exactly what I want.

Thanks!

acity609

 The serialization of the DOM may not match the page source exactly so then you need to construct this declaration manually, by retrieving the <iframe>'s document.doctype property and then adding all of the attributes to the <!DOCTYPE> declaration yourself.