High-order harmonic generation (HHG) is an all-optical method to acquire the microscopic properties of materials. In recent years, with HHG as a bridge, the intersection between condensed matter physics and strong-field physics has become increasingly close. The Harper model has been proved to be topologically nontrivial, with edge states in the gap. By scanning the translational degree of freedom, it is found that the edge states can be sensitively measured by using the enhancement of HHG below the minimum band gaps (MBGs), which has strong robustness in both periodic and quasiperiodic systems. In addition, we extend the detection of edge states to generally localized states, which may appear at the boundary between two topological phases. Connecting two systems through a continuous deformation region (CDR), if the HHG minimum below the MBG does not change significantly with the CDR length, the topological phases are equivalent. In contrast, if the minimum is rapidly submerged with the increase in the CDR length, the two systems are not equivalent.