مۇنازىرىلەر » ئىجادىيەت

Change the page without Reloading

§
يوللانغان ۋاقتى: 2022-08-05

Hi, i have created an script but i want to make it so it doesn't reload the page when you click on the shortcut

https://greasyforks.org/en/scripts/449016-playlists-buttons

    playlist.onclick = function(){location.href = playlistlink;};

I have tried to use history.pushState but it only changes the URL! And doesn't update the page.

§
يوللانغان ۋاقتى: 2022-08-06

You would have to iframe the whole page. It is still the same thing as reloading, but it's not visible to the user.

§
يوللانغان ۋاقتى: 2022-08-06

I have found a way for it to work!!! :)

All i had to do is remove the function and set the href directly, soundcloud did the rest for me.

§
يوللانغان ۋاقتى: 2022-08-08

there is no need to js or jquery. to stop page reloading just specify the button type as 'button'. if you dont specify the button type, browser will set it to 'reset' or 'submit' witch cause to page reload.

جاۋاب قايتۇرۇش

جاۋاب قايتۇرۇش ئۈچۈن كىرىش.

长期地址
遇到问题?请前往 GitHub 提 Issues。