I have a .html-file that loads a javascript when loaded. I use this to turn on/off electronics in my home.
Currently I have saved the link on my homescreen (iPhone), and I have set the window to close automatically after 1 second of it being opened (which is enough for my javascript to run).
However, I think it would be much more cool, if I somehow could get Safari to close after closing the window. In that way I could return to my homescreen, so I wouldn't have to touch the homebutton, and thereby using this link as a sort of "switch" on my homescreen to turn on/off my electronics.
I have thought of using some code like:
function redirection() {
var userAgent = window.navigator.userAgent;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
window.location = "myapp://"
}
}
</script>
But this would require a URL Scheme for the dashboard, which I don't think exist (?).
Do you have any other suggestions or is this task just not possible to perform? :)
Thanks in advance