Do I have a way (when I get the “unload”) to distinguish between “X” button and another cases(for example when moving writing another URL address)?
I want to decide what message to display to the user when I get to the unload event, if this possible to do?

A site that does anything other than close when I click close, will never get another visit.
That is a typical ploy of mal-sites
I do not want you to prevent me from navigating my browser.

A site that does anything other than close when I click close, will never get another visit.

+1

You can always provide an easy-to-use navigation menu if you need your users to be able to get around easily.

the unload is usually used to only perform code cleanup, like freeing allocated memory, that needs to be done for the code earlier on the page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.