A highly sensitive and selective optical membrane for determination of Hg 2+ and Pb 2+ in industrial wastes, spiked tap water and natural waters has been developed by covalent immobilization of dithizone on agarose membrane. In addition to its high stability, reproducibility and relatively long lifetime, the proposed optical sensor revealed good selectivity for target ions over a large number of alkali, alkaline earth, transition, and heavy metal ions. The proposed optical membrane displays linear responses from 1.1 × 10 ? 8 to 2.0 × 10 ? 6 mol L ? 1 and 1.2 × 10 ? 8 to 2.4 × 10 ? 6 mol L ? 1 for Hg 2+ and Pb 2+ , respectively. The limits of detectio based on IUPAC method were 2.0 ×10 ? 9 mol L ? 1 and 4.0 ×10 ? 9 mol L ? 1 for Hg 2+ and Pb 2+ , respectively. A highly selective and low cost optical membrane for sensing dissolved ammonia based on the simultaneous production and immobilization of Fe 2 O 3 -nanoparticles onto agarose membrane was prepared. The proposed method has no problems about fuel consumption and environmental pollution by toxic solvents. The phase, size and morphology of the prepared iron oxide nanoparticles were characterized by scanning electron microscopy, atomic force microscopy, FT-IR spectroscopy and X-ray diffraction. The proposed sensor displays a linear response for ammonia over a concentration range of 1.3 ×10 ? 7 to 4.2 × 10 ? 5 mol L ? 1 with a limit of detection of 3.1 × 10 ? 8 mol L ? 1 and a response time of less than 3 min. In addition to its high stability, reproducibility and relatively long lifetime, the proposed optical sensor revealed good selectivity for ammonia over potential interfering species.