0

I have done a small extension that change the default search engine and set the do not track function to on. The extension works, but it causes an issue on my website (and maybe others too).

On my website I have a settings page, to change some stuff, like the text color, the language. When I turn on the extension, the settings are not working any more. The buttons don't save my choices.

Edit: I noticed that the problem is coming from the "chrome_settings_overrides" part. If I take it off the buttons are working just fine again. Maybe something is blocking the POST request?

I have validate my website as a owner in the Google dev dashboard, but that don't change anything.

Here is the manifest.json :

{
  "incognito": "spanning",
  "name": "...",
  "version": "1.0.5",
  "manifest_version": 2,
  "minimum_chrome_version": "23",
  "icons": {
    "16": "images/logo-16.png",
    "32": "images/logo-32.png",
    "48": "images/logo-48.png",
    "128": "images/logo-128.png"
  },
  "chrome_settings_overrides": {
      "search_provider": {
         "encoding": "UTF-8",
         "favicon_url": "http://www.mywebsite/favicon.ico",
         "is_default": true,
         "keyword": "...",
         "name": "...",
         "search_url": "http://www.mywebsite/search/index.php?a=web&q={searchTerms}"
      }
  },
  "description": "...",
  "default_locale": "fr",
  "background": {
    "scripts": [
      "scripts/background.js"
    ]
  },
  "browser_action": {
    "default_icon": {
      "16": "images/logo-16.png",
      "32": "images/logo-32.png",
      "48": "images/logo-48.png"
    },
    "default_title": "mywebsite"
  },
  "options_page": "options.html",
  "options_ui": {
    "page": "options.html",
    "chrome_style": true
  },
"permissions": [ "cookies", "webRequest", "webRequestBlocking", "activeTab" ]
}

And I use this kind of button for my settings page:

<form action="http://www.mywebsite.com/search/index.php?a=preferences" method="POST" class="form-horizontal">
 <label class="radio">
   <input type="radio" name="linkw" id="linkOffw" value="_top" {$linkOffw} />
   <strong>Non</strong> - Ne pas ouvrir les r&eacute;sultats dans un nouvel onglet.
  </label>
  <label class="radio">
   <input type="radio" name="linkw" id="linkOnw" value="_blank" {$linkOnw} />
   <strong>Oui</strong> - Ouvrir les r&eacute;sultats dans un nouvel onglet.
  </label>
<button type="submit" class="btn btn-info">Enregistrer mes pr&eacute;f&eacute;rences</button>
 <a href="http://www.mywebsite.com" class="btn">Retour</a>
</form>

Do I need to set some permissions on my manifest or something like that?

Here is the background.js

chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
 details.requestHeaders.push({name: "DNT", value: "1"});
 return {requestHeaders: details.requestHeaders};
}, {urls: ["<all_urls>"]}, ["requestHeaders", "blocking"]);

function iconClicked() {
    chrome.tabs.create({
        'url': 'http://www.mywebsite.com'
    });
}

chrome.browserAction.onClicked.addListener(iconClicked);
halfer
  • 19,824
  • 17
  • 99
  • 186
tonarii
  • 25
  • 6
  • 1
    Could you also provide `background.js`? it's critical I guess – Haibara Ai Sep 02 '16 at 10:30
  • Hi Haibara Ai , thanks for your reply. yes sorry :) I edited my first post. – tonarii Sep 02 '16 at 10:34
  • Any errors/messages in web console of the site (F12 key) or in [background page console](http://stackoverflow.com/a/10258029)? – wOxxOm Sep 02 '16 at 11:02
  • Hello wOxxOm, thanks for your reply :) No errors on both pages, site and background page. – tonarii Sep 02 '16 at 11:17
  • Does the problem occur if you open your site manually via addressbar, not by clicking the extension's icon? – wOxxOm Sep 02 '16 at 11:32
  • The problem is the same if i click on the extension's icon or if i open manually the site. With the extension none of my settings buttons are working, and without the extension everything works just fine. – tonarii Sep 02 '16 at 11:35
  • Hello, sorry for the double post, i noticed that the issue is coming from the "chrome_settings_overrides" part. When i take it off, the buttons are working. – tonarii Sep 04 '16 at 08:16

1 Answers1

0

i solved the issue. It was something stupid, so stupid that you don't think about it... The problem came from the "search_url", i was not using HTTPS in my url, and you MUST use HTTPS. Raaaaaaaaaaa ! But now that's fine, that's the most important things. Thanks.

tonarii
  • 25
  • 6