google-chrome

Event onbeforeunload isn't fired in Chrome Incognito

冷暖自知 提交于 2021-02-08 15:12:37
问题 I've been trying to send a beacon on beforeunload and it seems to work on pretty much all modern browsers, except Chrome in incognito mode. This is the code that works in all modern browsers, except Chrome in incognito mode: window.onbeforeunload = function() { navigator.sendBeacon("url"); } Not even this code doesn't seem to work: window.onbeforeunload = function() { console.log('before unload') } Am I doing anything wrong or is it just Chrome's fault? 回答1: What's your setup (SO, Chrome

Unable to use navigator.geolocation due to 'Only secure origins are allowed'

前提是你 提交于 2021-02-08 15:12:12
问题 There has been an error, in the console, since I made my website using navigator.geolocation.getCurrentPosition (below). I realised this was going to cause a problem at some point in the future, and as I'm only playing with web development it didn't concern me that much, but it has now completely screwed up my little weather app (http://conn3cted.uk.tn/weather.html) as it seems that I can't use this function in chrome (it works in firefox) anymore. The error I'm getting additionally now is

Unable to use navigator.geolocation due to 'Only secure origins are allowed'

≡放荡痞女 提交于 2021-02-08 15:09:22
问题 There has been an error, in the console, since I made my website using navigator.geolocation.getCurrentPosition (below). I realised this was going to cause a problem at some point in the future, and as I'm only playing with web development it didn't concern me that much, but it has now completely screwed up my little weather app (http://conn3cted.uk.tn/weather.html) as it seems that I can't use this function in chrome (it works in firefox) anymore. The error I'm getting additionally now is

Opening a PDF embedded in iframe in chrome with content security policy > plugin-types

可紊 提交于 2021-02-08 14:58:44
问题 I have the CSP (Content-security-policy) plugin-types policy set to white-list pdf type as below. When trying to open a PDF file in iframe with src attribute, It is working well with browsers IE 11, and Firefox 47+ but failing in Chrome 50+. What else is required to make it working in chrome? Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'self'; style-src 'self'; frame-src 'self' plugin-types application/pdf; Error in chrome console

Open with chrome instead of download it [closed]

泪湿孤枕 提交于 2021-02-08 13:52:40
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 1 year ago . Improve this question I encounter a problem when I try to open a txt file with chrome from my local file system(file:///home/solomon/Desktop/temp2.txt), chrome save another copy in my download folder instead of open it:( I want to open and view any text based file with chrome, because

Way to Open Clicked Link in New Tab via Tampermonkey?

梦想的初衷 提交于 2021-02-08 13:45:26
问题 So I have what seems to be a simple problem. I'm trying to automatically open a specific link on a page using the following code: // ==UserScript== // @name AutoClicker // @include https://example.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @grant GM_addStyle // ==/UserScript== var TargetLink = $("a:contains('cars')") if (TargetLink.length) window.location.href = TargetLink[0].href //--- but open it in a new tab Which works splendidly. The only problem

Double request when chrome developer tools open

主宰稳场 提交于 2021-02-08 12:59:33
问题 I've an odd problem, i have a very simple node/expressjs app ( i have a much more complex one but this simple example shows the problem ). This app has three routes as shown here: var i = 0; app.route('/login') .get(function(req, res){ console.log('login', ++i); res.send('login'); }) app.route('/test') .get(function(req, res){ console.log('test', ++i); res.send('test'); }) app.route('/') .get(function(req, res){ console.log('index', ++i); res.send('index'); }) Pretty simple. Any time one of

Gradient in defs not showing up in SVG sprite in Chrome (webkit-based browsers)

谁说我不能喝 提交于 2021-02-08 12:27:13
问题 I have an SVG which represents the Google Play Store badge: <?xml version="1.0" encoding="utf-8"?> <svg id="master-artboard" viewBox="0 0 740.4884643554688 219.59970092773438" version="1.1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet"> <defs><linearGradient id="a" x1="31.8" y1="183.29" x2="15.02" y2="166.51" gradientTransform="matrix(1 0 0 -1 0 202)" gradientUnits="userSpaceOnUse"> <stop offset="0" stop-color="#00a0ff"/> <stop offset=".01" stop-color="#00a1ff"/>

Why does comparing {} and [] show an error? [duplicate]

a 夏天 提交于 2021-02-08 12:20:15
问题 This question already has an answer here : Why does {} == false throw an exception? (1 answer) Closed 3 years ago . On my free time, I was just playing with js console, I got an unexpected error: js> [] == {} false js> {} == [] typein:5: SyntaxError: syntax error: I tried with === : js> [] === {} false js> {} === [] typein:9: SyntaxError: syntax error: Am thinking wrong here? I tested this with Firefox, Chrome and jscore. 回答1: That's because in the second case, {} is interpreted as a code

Code injection using executeScript never call callback in Chrome extension

送分小仙女□ 提交于 2021-02-08 11:47:18
问题 I am trying to create Chrome extension I am creating (intended to automatic fill form on third-party site - I know what you thought, not for spam, no). So when I am trying to inject JS into this page using executeScript it never calls callback function. Here is the code: function doStepPopup () { console.log ("Step "+step+" begins"); debugger; var tab = curTab; chrome.tabs.executeScript (null, { file: "extfiller.js" }, function () { debugger; console.log ("Script injected for step "+step); ..