mercredi 25 mars 2015

Firefox Detect if a page is loaded in the "sidebar" (Javascript)

Firefox has this wonderful option when you create a bookmark : you can load a specific page directly in the sidebar. But it's not very well documented on how you can detect as a web developer that your page is actually shown in such a sidebar.
This is the javascript trick I used (validated with Firefox version=20.0.1):
{ if (window.content == window) /* not sidebar */ else /* sidebar */ }
Source :

Aucun commentaire:

Enregistrer un commentaire