browser-extension

Content Security Policy for extensions and bookmarklets

不问归期 提交于 2019-12-20 09:54:26
问题 Github has the following Content Security Policy: Content-Security-Policy:default-src *; script-src assets-cdn.github.com www.google-analytics.com collector-cdn.github.com; object-src assets-cdn.github.com; style-src 'self' 'unsafe-inline' 'unsafe-eval' assets-cdn.github.com; img-src 'self' data: assets-cdn.github.com identicons.github.com www.google-analytics.com collector.githubapp.com *.githubusercontent.com *.gravatar.com *.wp.com; media-src 'none'; frame-src 'self' render

How to use React without unsafe inline JavaScript/CSS code?

删除回忆录丶 提交于 2019-12-20 02:35:31
问题 Background I have to use a Content Security Policy for a react application. The reason, that is however not of a big matter here, is, that I am creating a WebExtension/Browser Extension/add-on and these do have such a content security policy, and there things like 'unsafe-eval' and 'unsafe-inline' are strictly disallowed: extensions with 'unsafe-eval', 'unsafe-inline', remote script, blob, or remote sources in their CSP are not allowed for extensions listed on addons.mozilla.org due to major

How to use React without unsafe inline JavaScript/CSS code?

喜夏-厌秋 提交于 2019-12-20 02:35:08
问题 Background I have to use a Content Security Policy for a react application. The reason, that is however not of a big matter here, is, that I am creating a WebExtension/Browser Extension/add-on and these do have such a content security policy, and there things like 'unsafe-eval' and 'unsafe-inline' are strictly disallowed: extensions with 'unsafe-eval', 'unsafe-inline', remote script, blob, or remote sources in their CSP are not allowed for extensions listed on addons.mozilla.org due to major

How do I get the element being edited?

时光总嘲笑我的痴心妄想 提交于 2019-12-19 05:09:06
问题 I'm developing a webapp, and I have a problem with the JavaScript. The following is a simplified version of the HTML causing the problem. I have some nested contenteditable divs (I replaced the real content with placeholder text): <div contenteditable="true" id="div1"> text <div contenteditable="inherit" id="div2"> text <div contenteditable="inherit" id="div3"> text </div> text </div> text </div> I want to get the element that's selected (being edited by the user) via JavaScript, but so far I

JQuery injecting click()

眉间皱痕 提交于 2019-12-13 22:17:00
问题 I am currently building a browser extension that injects javascript/jquery into certain pages, and i am having a weird issue, where forcing .click() events are not working from my injected code. The strange bit is that it works completely fine if i make the call from my console js console. I dont really understand what the problem is. It seems that all of my other calls are working fine. I can bind to click events using .click(function(){...}) (so clearly my jquery has been loaded properly),

Sending Data From background.js to extension.js in crossrider

大兔子大兔子 提交于 2019-12-13 04:37:38
问题 I am developing a browser extension using crossrider. I have added a context menu (background.js) var ContextData; appAPI.contextMenu.add("key1", "Send Data To Server", function (data) { var ContextData = 'pageUrl: ' + data.pageUrl + '\r\n' + 'linkUrl: ' + data.linkUrl + '\r\n' + 'selectedText:' + data.selectedText + '\r\n' + 'srcUrl:' + data.srcUrl; }, ["all"]); On user click I want to send ContextData to extension.js. At extension.js some function will receive the data and send it to my

How to send data from popup script to background.js in crossrider?

我只是一个虾纸丫 提交于 2019-12-12 02:32:48
问题 I am developing a browser extension using crossrider. I have some resource pages like popup.html and popup.js. In popup.html, there is a form and when user submit the form I want to send the data to my server, which is straight forward. But I also want to send the active tab url along with the form data. But we can get the active tab url in background.js only. To do this I need to send the form data to background.js and then post them to my server. So my question is how to send data from

Chrome extension message passing is not working?

冷暖自知 提交于 2019-12-11 16:28:49
问题 In contentScript.js the function is not called. background.js var insertUI = true // var hasExecutedOnce = false chrome.browserAction.onClicked.addListener(function(tab) { console.log(`clicked browserAction`) // if (!hasExecutedOnce) chrome.tabs.executeScript(tab.id, { file: 'contentScript.js', }) chrome.runtime.sendMessage({ from: 'background', subject: insertUI ? 'insertUI' : 'removeUI', }) chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { if (request.subject ==

Advantages & Disadvantages of writing IE addons in .NET

若如初见. 提交于 2019-12-11 15:13:33
问题 Since i am a .NET developer, I am planning to write a IE addon in .NET. Does anyone here have experience with/in developing IE extensions in .NET that can share their knowledge? Specifically i like to know about advantages & disadvantages of using .NET for this task in comparison to ATL COM. 回答1: I'd rather say that advantages & disadvantages are not bound to IE addons but more to the programming languages and their platforms. .NET: It is easier and more safe then C++ Easy to create and

How to open mailto link in Chrome with Window.open without creating a new tab?

回眸只為那壹抹淺笑 提交于 2019-12-10 18:13:35
问题 I am creating a Google Chrome extension and am trying to open a custom url scheme with (window.open) without having a new blank tab open up. For sake of argument lets try the 'mailto' url scheme. My code: window.open("mailto://Bob Lawblah", '_self'); Unfortunately this open up a new blank tab as well as opening up the default mail program even though I specified '_self'. According to this I don't seem to be anything wrong. Any ideas on how to not have an extra tab open when opening a 'mailto'