Select the 'Tools->Internet Options' menu item, and then open the 'Privacy' tab - you can then adjust the slider to block or allow various categories of cookie. Alternatively by clicking 'Advanced...' you can exercise finer control over the browser's behavior, choosing whether to accept, block, or prompt for cookies originating either on the website you are visiting (first party cookies) or originating from websites other than the one you are visiting (third party cookies, typically used by banner advertisements hosted on an advertiser's website).
Use the 'Tools->Options' menu item (may be under the Firefox button), then choose the 'Privacy' tab. Set the 'Firefox will:' option to 'Use custom settings for history'. Now you can choose whether cookies are enabled for websites you visit and third party websites, and if so how long they will persist. You can also use the 'Exceptions' button to override the settings for particular websites.
Choose 'Options' on the 'Cutomsize and control' menu, then open the 'Under the Bonnet' tab. In the 'Privacy' section, click on the 'Content settings...' button and open the 'Cookies tab. Set the required cookie behaviour and use the 'Exceptions...' button (if required) to configure specific websites.
Choose 'Preferences...' on the 'Settings' or 'Edit' menu (Windows) or the Safari menu (MacOS), then open the 'Privacy' tab. Now set the required cookie behaviour.