0

My Manifest File is manifest.json

{
  "name": "Test",
  "description": "Test Desc",
  "version": "1.1",
  "background": {
        "scripts": ["./others/dependencies/src/background_tabs.js"]
  },
  "permissions": [
    "tabs", "http://*/*", "https://*/*", "https://ajax.googleapis.com/"
  ],
  "browser_action": {
      "default_title": "Test Title"

  },
  "manifest_version": 2
}

And My Background_Tabs.js is

getCurrentTab(){ 

    console.log(chrome.tabs);
};

 getCurrentTab();

And Atlast i added the manifest file to index.html web app -

<!DOCTYPE HTML>
<html>
<head>
    <link rel="shortcut icon" href="./resources/images/favicon.ico" type="image/x-icon" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=yes">

    <title>Test</title>

    <link rel="manifest" href="./manifest.json">
...

Now when i see my console after loading the webpage - It returns as undefined for 'chrome.tabs'.

How can i resolve this?

Rush W.
  • 1,321
  • 2
  • 11
  • 19
  • 1
    Why do you think web app can access chrome.tabs which is only for chrome extensions and chrome apps? – wOxxOm Oct 17 '17 at 10:05
  • @wOxxOm What i want is to disable multi tabs for a web app! So i came across with chrome tabs.. Do you have a solution? – Rush W. Oct 17 '17 at 10:14
  • 1
    Well, write a chrome extension then. – wOxxOm Oct 17 '17 at 10:24
  • @wOxxOm which will the easiest and fastest solution for disabling multitabs? Is it only chrome extension? But since this web app will be going to users, how am i supposed to force them to install a chrome extension? What if the user is on Mozilla? :D Help me! – Rush W. Oct 17 '17 at 10:27
  • 2
    I see no way I can help you as I don't have any idea what that web app is or does. – wOxxOm Oct 17 '17 at 10:33
  • 1
    I suggest you read the [Chrome extension overview](https://developer.chrome.com/extensions/overview) (perhaps along with the pages linked from the overview). The [architecture section](https://developer.chrome.com/extensions/overview#arch) has overall architecture information which should help your understanding of how things are generally organized/done. You should also read [Content Scripts](https://developer.chrome.com/extensions/content_scripts). – Makyen Oct 17 '17 at 15:17

0 Answers0