lichess.org
Donate

Embedding games in websites

A feature to show games you're playing live on your website would be nice... or maybe a way for a visitor to join a game if you're logged in and not playing.
Funnily enough, I think there might be an existing solution for showing the game live on an external website.

Every game such as http://en.lichess.org/zlma26yn has a corresponding PGN url http://en.lichess.org/zlma26yn/pgn -- if you know how to use pgn4web (http://pgn4web.casaschi.net/home.html), or are willing to find out how, you should be able to use that url with pgn4web to display your game.

I have not used it myself so I don't currently have detailed advice to give, but there are instruction in general at the pgn4web wiki (code.google.com/p/pgn4web/wiki/Index?tm=6) and in particular the pages on the live broadcast mode (code.google.com/p/pgn4web/wiki/Live_Broadcast) (code.google.com/p/pgn4web/wiki/BoardWidget_live) (code.google.com/p/pgn4web/wiki/DynamicFrame_LiveFullscreen)
As for 'or maybe a way for a visitor to join a game if you're logged in and not playing.' -- I'm not sure what you mean?
Something like "challenge me" that allows guests to play a game with you. Of course you'd have to be logged in to your lichess account for that to work.
Yes a live PGN url would be easy enough to incorporate into your website.
The pgn urls are already in place! :) They work for currently ongoing games as well! You should be able to find the proper link by either a) *Right*-clicking the 'View PGN' link in the box under a game and choosing 'Copy link location' or 'Copy link address' or whatever your browser has named that option, or b) adding '/pgn' to the address of the public url of your game (which game observers see, and which is also the same as a the link under the text 'To invite someone to play, give this URL:' which you post to someone for an invitation game), which is the shorter version of the private url (which you have in your location bar while you're actually playing the game).

Of course using that url together with pgn4web might not be quite as neat as having the same feature fully integrated on the site, but at least it's something that can be tried already.

As for 'challenge me' do you mean that as in some button that would also be embedded on another website? I suppose that sort of feature would not be available at least unless/until a similar feature is also introduced to the site itself.
Yeah I saw that there are PGNs available for games, but I had thought maybe that was only available when you're analyzing games after they're played.

I do believe thibault added FEN notation too, so using either would make it easy to an embed a game in a website.

For 'challenge me', yes - exactly what you said - a button embedded in another website that allows people to request to play a game with you. Sort of like the existing 'play with friends' feature but you're the one who's being challenged. That might be a good feature to have on the site as well.
Yeah, neat ideas -- in fact I actually thought for a moment that even the challenge button could at the moment be implemented without needing changes to the site code -- you could have some script that sets up an invitation game and then sends the invitation url to the user's lichess inbox. The problem of course is that anonymous users can't send messages like that.

This topic has been archived and can no longer be replied to.