how to trigger the browser geo location request again after clicked allow - javascript

Its more for web development, I wonder once a user clicked yes on the browser's location request, then refresh the same page, it does not prompt again. I wonder what is the thing that control if its going to prompt again? Is there way to allow the prompt to trigger again with javascript?
for example the prompt looks like this in safari

Related

Add To Home Screen / add Bookmark on screen for Every Single page

When the user opens the website to the mobile device, the browser should ask Add To Home Screen or Add Bookmark To Screen like PWA for every single page I mean different for every URL.
Note: Here I'm not talking about PWA (Progressive Web App), I know how to create PWA and I've created it.
I just want to know that what I am asking is possible or not to ask the user to add a bookmark on every single page he opens just like PWA.
No. You cant. Here is my detailed answer on why.
That would be so annoying to a user and no browser will let you do that (even if you think its a valid use case for your scenario).
Thats why browsers don't give control over how the install prompt event is triggered. Install prompt can be caught and shown once in the right time when you think user will be convinced to install it. If the user defers to install, you need to wait for a long time to catch the same event again to show the prompt again. How long is something depends on the browser and there is no standard time defined by any browser vendor.
Basically, if browser thinks user might like to add again based on the length and frequency of usage, then it will trigger the prompt event again. But that wont be in the same session/day for sure.

Windows service to automate a job

I am trying to automatestrong text a certain task and the procedure of it is as follows:
Open web browser (Google Chrome)
Go to a certain site
Put in username then jump to another field (like pressing the Tab
button.. it automatically log ins since I am connected to the
office network)
Type again on a certain field
Click search button etc etc
Is it better to code a windows service? Are there any other ways to do the above task? I wanted to automate it because the job is just more about Click, Type, Click, and Wait. The values are also somehow fixed so it could really be automated.

How to reset location warnings in ios from javascript

Is it possible to reset the location warnings in ios from javascript run on the website?
I am finding that if users keep denying access to their location when visiting my website that eventually they no longer get the choice. Now I know that they can reset their settings on their iPhones but I would like to be able to force the "Deny or Allow" dialog box to appear every time they visit my website.
Is this possible? If so how?

Alert user in browser of activity in separate tab

We are using a Silverlight application together with a third party dashboard tool, both running in separate tabs.
When we click in the dashboard we use SignalR to communicate with the Silverlight application.
Whenever this happens, we want to highlight the tab of the Silverlight application, however we do not want to use an alert box because this requires the user to do an extra click.
Is there a way we can trigger an alert box in the Silverlight application (or html page it is running in) to do an alert that disappears after x seconds?
Either we want a focus on the tab of the Silverlight application (however this is browser blocked) or have a tab highlight which, besides clicking the tab, does not require any user interaction.
The application is browser independent.
Create a child window that pops up and will close after a certain amount of time. You can make it look like an alert if you need to.
How about a solution that attracts the user's attention like web basted applications as Google Talk and Facebook Chat? They change the title on interval basis.
In my opinion you won't find any other, better, cross-browser solution at this moment.
You could hook a dedicated piece of javscript to a SignalR hub on every page you'd like. As soon as you focus on the tab you'll stop flashing.
Here you'll find a jQuery plugin that does what I just suggested

How to change browser focus from one tab to another

I have a JavaScript chat client running in one browser tab (call it tab A). Now when a message arrives the user might be on another browser tab (call it tab B). I'm looking for ways to change the focus from tab B to my chat client (tab A) when such a message arrives.
I could not find a way to do this.
It is not possible - due to security concerns.
unless by "tab" you mean a window and a popup window that (due to browser preferences) opened up in a new tab. If this is the case, then yes you can.
//focus opener... from popup
window.opener.focus();
//focus popup... from opener
yourPopupName.focus();
The best you could would probably be to change the title of the page alerting the user the tab needs attention (maybe also the favicon - look at how meebo does it, it's really annoying but effective)
It is possible to shift focus back to Tab A by means of an alert in Tab A e.g. alert('New Message')
However, you need to be careful using this as it is very likely to annoy people. You should only use it if you make it optional in your app. Otherwise, updating Tab A's title and/or the favicon would appear to be best as nc3b says.
Chrome and firefox now have notifications. I think notifications are probably a more user friendly way to alert the user that something has changed on your app than popping an alert and forcing them to your page.
Using Javascript, triggering an alert can have the desired effect. Run this code in your console, or add to your html file in one tab and switch to another tab in the same browser.
setTimeout(function(){
alert("Switched tabs");
},
5000);
The alert appearing after the timeout will trigger tab switch. Or you can do something similar! For UX reasons however, you can still use a ping or add and indicator like in Facebook's message counter in the page title ( (1) Facebook ). You can also experiment with Notifications API (experimental).
this worked for me on form submit to reopen the target window..
so it will call window.open on the same target (or new if changed) and then continue to submit the form.
var open_target = function (form){
var windowName = jQuery(form).attr('target');
window.open("", windowName );
return true;
};
<form target="_search_elastic" onsubmit="return open_target(this);">
</form>
Some regular chrome based browser may be controlled by chrome debugger protocol, If browser open with flag --remote-debugging-port=***,I have used the tool cyrus-and/chrome-remote-interface on github and call the CDP.Activate([options],callback) method to switch the browser tab. It works on New MS Edge, should work on chrome also. But sadly this did not work in vivaldi browser, the most feature rich browser I want to use.

Categories

Resources