REST calls in Homepage reddit / selfhosted ---------------------------------------------------------------------- sjgoalie · 2023-10-16 05:30 Is there a way to specify something like: target: _None or some other way that will let me call a REST URL when you click something, and ignore the response completely? I don't want it in a new tab/window etc, just dump it to /dev/null. It turns my link/service into a proper button. Is there some trick in custom service that will do the same thing? ---------------------------------------------------------------------- thekrautboy · 2023-10-16 05:34 I dont think that is currently possible, but it might be a great idea to suggest it as a feature: https://github.com/gethomepage/homepage/discussions ---------------------------------------------------------------------- Conscious-Fault-8800 · 2023-10-16 05:50 No. But you can do it via Javascript ---------------------------------------------------------------------- sjgoalie · 2023-10-16 06:45 I got this working, thanks for the idea. I will prob still submit a feature request. It seems like a simple addition to the target option would be easier for most folks. ---------------------------------------------------------------------- root-node · 2023-10-16 14:27 Mind sharing your work for others that may want this. ---------------------------------------------------------------------- sjgoalie · 2023-10-16 17:27 Good idea, I should have done that last night. It's pretty simple, but I dont do much js work so there's probably a cleaner way to do this. This creates a hidden iframe and sets the target of any items you want to go to that iframe. Simply set the ID: value of any bookmarks or whatever to "specialIDForRESTCalls" and this code does the rest on page load. I have given no thought to browser portability or security with this solution, it works in Chrome on my laptop which is all I needed. I've also only been using Homepage for a few hours, so I hope this doesnt break anything else. If anyone has come fixes/upgrades to this please let me know. custom.js let iFrame = document.createElement('iframe') iFrame.id = 'hiddeniFrame' iFrame.name = 'hiddeniFrame' iFrame.src = 'about:blank' iFrame.style.display = 'none' document.body.appendChild(iFrame) var eleList = document.querySelectorAll('#specialIDForRESTCalls'); eleList.forEach(function(ele) { var link = ele.getElementsByTagName('a'); for (let i of link) { i.setAttribute('target', 'hiddeniFrame'); } });