Here is my other idea. Right before the take off while taxing every airplane is scanned by an external laser device for presence of explosive ingredient vapors on board.
Such device currently exist for detection of alcohol in cars. https://www.sciencedaily.com/releases/2014/06/140602155959.htm
The use of the device is simple: The laser system is be set up on the side of the runway to monitor each plane that passes by. If any explosive materials vapors are detected, the plane is diverted from take off. The database used by the device will be regularly updated as new data regarding materials used for making explosives becomes available.