I accidently checked the "disable alerts from this site" box in Chrome, and now I cannot get any window.alert to work on my localhost.
I have tried resetting the settings in advanced but no luck.
Close and re-open the tab. That should do the trick.
I can see that this only for actually turning the dialogs back on. But if you are a web dev and you would like to see a way to possibly have some form of notification when these are off...in the case that you are using native alerts/confirms for validation or whatever. Check this solution to detect and notify the user https://stackoverflow.com/a/23697435/1248536
In Chrome Browser go to setting , clear browsing history and then reload the page
Related
I have created a webpage that works best with Chrome. If the user opens this page from Safari, I want to put a button that says "Click here to open this page in Chrome". Upon clicking this button, Chrome should fireup and load the specified URL.
Is there a way to do that? Or even just to launch Chrome from Safari?
There actually is a way, if you want to do this, make the button, and set the href to the link, but at the beginning, delete ‘https://‘ and replace it with ‘googlechromes://’, for example ‘googlechromes://YouTube.com’ if you go to that link in safari, it will ask, “do you want to open this page in chrome?” And if you click yes it will open chrome over safari
There is no way to this within the browser, but here a few work-arounds. You could ...
Make a button to copy your URL to their clipboard so they can paste it in Chrome
Send the user to a download link if they don't have chrome (just ask them if they have chrome or not)
Close the tab in the browser after the URL is copied
You could use window.close() or just close(), as pointed out in this answer.
These are just some thoughts. It's the best anyone could do for a problem like this. I hope this helps.
Trying to debug a problem that's IE-11 specific, I would like to see the console messages logged when a certain control is clicked. But the control refreshes the page, which makes F12 tools automatically clear the console, so whatever is logged just before that, I don't get to see!
Past versions of IE had an option to keep the console contents on navigation. Is this option available in IE11? If so, where is it? If not, is there some other way to view the console that doesn't immediately discard the message I want to see?
In with the latest F12 update to IE11 (that came as part of the Win8.1 Update) there is now a button to disable "Clear on Navigate"
Additionally, you can enable IE to record messages in the Console at all times instead of only when the Console is open.
For all the changes to the IE11 F12 dev tools see: http://support.microsoft.com/kb/2929437
Ran into this and I didn't find a good solution, but I found a hacked one that worked well enough for me to debug.
Use window.onbeforeunload to pop up a window so you can at least see the values before they are purged.
See: Prompting and preventing user from navigating away/closing a page
For non-negotiable reasons unique to the legacy system I am doing work on, a POST query is used to switch between tabs of a particular web interface.
On occasion, I need to trigger a refresh of the current tab and would typically use js's location.reload() to accomplish this. However, in this context the behavior is different in Firefox vs. Chrome.
Specifically, FF resubmits the POST query that brought me to my current page, whereas Chrome does not. As a result, FF ends up where I started, and Chrome instead goes to the URL in the address bar.
Does anyone know of a cross-browser means of accomplishing what FF does by default on location.reload()?
Try using it with true
window.location.reload(true);
I believe this is a bug in Chrome.
Take a look at the attached bug description.
http://code.google.com/p/chromium/issues/detail?id=30479
Although it mentions the back button, I see the same issue using location.reload(true) if I have a form using session cookies. That is, in IE and FF it reposts and reloads OK. In Chrome it does not.
Reload using location property:
window.location = window.location;
In my project I have a requirement where in I need to remove the addressbar for a pop up but retain the back,forward and refresh buttons on the tool bar. So the option toolbar=0 for the pop up does not work for me. I just want to remove the addressbar and nothing else from the browser pop up. Kindly help me with this.
You can try setting location=0 in the option string (see the Mozilla and Microsoft docs), but do note that most modern browsers will force the presence of the location bar anyway.
What browser are you testing in? Someone else chime in if I am wrong but I think Chrome will not let you remove the address bar.
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.