How to make Chrome remember password for an AJAX form?

I have found a dirty workaround for this problem, by inserting an invisible iframe and targeting the form to it: <iframe src=”” id=”loginTarget” name=”loginTarget” style=”display:none”> </iframe> <form id=”loginForm” action=”” method=”post” target=”loginTarget”></form> The corresponding JavaScript: $(‘#loginForm’).submit(function () { $.post(‘/login’, $(this).serialize(), function (data) { if (data.status == ‘SUCCESS’) { window.location = data.redirectUrl; } }) }) The trick … Read more

How do you detect between a Desktop and Mobile Chrome User Agent?

The problem is the user agent will always have “Chrome” whether it is the desktop or mobile version. So you have to check the more specific case first. $(document).ready(function(){ var ua = navigator.userAgent; if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(ua)) $(‘’).show(); else if(/Chrome/i.test(ua)) $(‘’).show(); else $(‘a.desktop-other’).show(); });

setcookie() does not set cookie in Google Chrome

Disabling cookies for IP addresses and localhost was a design decision. See also: Ways to work around the issue include: Set a local domain (e.g., edit /etc/hosts to use Use (which points to Use an empty domain value when setting the cookie. For example, in PHP: setcookie( $AUTH_COOKIE_NAME, $cookie_value, time() … Read more

Launch Google Chrome from the command line with specific window coordinates

When you’re using Google’s Chrome, there is a shorter way: “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –profile-directory=”Default” –app=”data:text/html,<html><body><script>window.moveTo(580,240);window.resizeTo(800,600);window.location=’’;</script></body></html>” Pro: Automatically opens the window Avoids the popup-blocker Opens multiple windows on different monitors (multi monitor setup, requires two or more Chrome profiles) Con: Only seems to work in “app” Mode Not tested with other browsers

Chrome version 18+: How to allow inline scripting with a Content Security Policy?

For recent versions of Chrome (46+), the previously accepted answer is no longer true. unsafe-inline still has no effect (in the manifest and in meta header tags), but per the documentation, you can use the technique described here to relax the restriction. Hash usage for <script> elements The script-src directive lets developers whitelist a particular … Read more