Aliexpress URL Cleaner

Removes unnecessary parameters from Aliexpress URLs

< Feedback on Aliexpress URL Cleaner


Posted: 2019-05-17

Greasemonkey compatibility

What a silly bug. I wondered why this doesn't work on Greasemonkey. Eventually I replaced all of the code in the script with just a console.log(), and that didn't do anything either. The culprit is @run-at document-body. Greasemonkey doesn't support that. By changing it to @run-at document-start, the script works.

But it didn't fix the links, just the URL of the current page. I added another logging call, and noticed that it found just one link to clean up. Seems that all the links to other products on the page are lazy-loaded, so they're not caught by this script. So it looks to me like you could remove all of the whenReady() stuff, and only do the window.history.replaceState() :smile:

Posted: 2019-05-27

Thanks for the feedback! I use aliexpress sporadically and on tampermonkey so it's greatly appreciated.

I changed the script to @run-at document-start as you suggested.

For the lazy-loaded links, I am now intercepting the jsonP requests through a mutation observer on document.head. It won't catch all of the links and it's bound to break easily, but the alternative would be to observe ALL the nodes and children added to the document or just not changing any of them.

Post reply

Sign in to post a reply.