How do I check if a call to window.location
failed because the given URL was invalid, etc? Is there some event I can set on the window object or on some other object that can catch this?
Steps to enable/disable Always detect my location in Weather on Win 10: 1 Step 1: Access Weather from the Start Menu. 2 Step 2: Click the Settings option on the left menu, and then select Always detect my location or Default Location. More ...
Window Location. The window.location object can be written without the window prefix. Some examples: window.location.href returns the href (URL) of the current page. window.location.hostname returns the domain name of the web host.
I would suggest you to try to set the location to check the status of the issue. Follow the steps. 1. Go to the Control Panel then try to search for region then in region tab click on location. 2. Try to select the location. 3.
Supposing that you want to protect your privacy, you can disallow the program to detect your position according to the guidance below. Step 1: Access Weather from the Start Menu. Step 2: Click the Settings option on the left menu, and then select Always detect my location or Default Location.
Finally got it to work using a "workaround" that is not a generic solution as I originally hoped:
I am using the fact that the link I am trying to open is a custom url scheme (e.g. myxx://localhost) on mobile, and if it fails, the action I want to perform is a redirection to a standard appstore URL (os-specific). The workaround tries to open the custom URL, and if it fails, the timeout function kicks in shortly after, and opens an alternative url:
setTimeout(function() { window.location=alternateUrl; }, 25);
window.location = customUrl;
The downside is that when the customURL fails, a standard safari browser shows a message box that the site could not be opened, but at least it still redirects the user to the appstore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With