Vessel trajectories from the Automatic Identification System (AIS) play an important role in maritime traffic management, but a drawback is the huge amount of memory occupation which thus results in a low speed of data acquisition in maritime applications due to a large number of scattered data. This paper proposes a novel online vessel trajectory compression method based on the Improved Open Window (IOPW) algorithm. The proposed method compresses vessel trajectory instantly according to vessel coordinates along with a timestamp driven by the AIS data. In particular, we adopt the weighted Euclidean distance (WED), fusing the perpendicular Euclidean distance (PED) and synchronous Euclidean distance (SED) in IOPW to improve the robustness. The realistic AIS-based vessel trajectories are used to illustrate the proposed model by comparing it with five traditional trajectory compression methods. The experimental results reveal that the proposed method could effectively maintain the important trajectory features and significantly reduce the rate of distance loss during the online compression of vessel trajectories.