How to Use Bookmarks#
I accidentally discovered that JavaScript can be used in the URL, which is a prerequisite. In daily use, some functions are specifically written as extensions for this purpose, which is a bit of a fuss. At this time, you can use bookmarks, which is convenient and also increases portability.
Bing to Google Search#
- Description: I usually use Bing as my search engine, but sometimes I'm not satisfied with the content on Bing and need to search again on Google. Due to the existence of the new Bing, I don't want to change the default search engine, but it's inconvenient to open Google and search again. So I added a bookmark for this.
- Code Explanation:
var currentUrl = window.location.href; // Get the current URL var reg = /q=([^&]+)/; var res = currentUrl.match(reg); // Match using regular expressions var googleUrl = "https://www.google.com/search?q="; var resultUrl = googleUrl+res[1]; // Concatenate window.open(resultUrl,'_self').close(); // Open the new website and close the original website
- Bookmark URL
{% note success %}
javascript:var currentUrl = window.location.href;var reg = /q=([^&]+)/;var res = currentUrl.match(reg);var googleUrl = "https://www.google.com/search?q=";var resultUrl = googleUrl+res[1];window.open(resultUrl,'_self').close();
{% endnote %} - Note: The regular expression was written by the new Bing, and it feels like a beautiful form of NTR.
Remove Song List Restrictions on Netease Cloud Music#
- Description: The web version of Netease Cloud Music has a limit on the number of songs displayed in a playlist, only showing 20 songs. I don't want to download the client because of this, so I added this bookmark.
- Code:
document.cookie="os=pc"; window.location.reload(); // Reload the webpage
- Bookmark URL
{% note success %}
javascript:document.cookie="os=pc";window.location.reload();
{% endnote %}