0

I obtain data through the following piece of code snippet

attend.js

var stuff = {}
for(i=1 ; i< 10; i++){
     at1 =$('table')[3].children[0].children[i].children[1].innerHTML;
     at =$('table')[3].children[0].children[i].children[8].innerHTML;
     at = at.substr(0, at.length - 1);

    console.log(parseInt(at));
    stuff[i] = { };
    stuff[i].course = at1;
    stuff[i].attendance = at;
}
console.log(JSON.stringify(stuff, null, '\t'));

which is inside attend.js file but this file wont run on the main home page.

But my home page requires this object.

My file hierarchy:

|-scripts-|atten/attend.js
          |home/main.js

Here both the scripts are in separate directories and also main.js file runs immediately when page loads, but the attend.js file runs only when we go to the specific url.

All I want is to run attend.js file immediately after main.js file is executed and store the stuff object in the main.js file to use.

Manifest.json

 {
            "matches": [
                "*://domain.com/*/attn_report.asp*"
            ],
            "all_frames": true,
            "js": [
                "scripts/jquery.min.js",
                "scripts/atten/attendance.js",
                "scripts/atten/attend.js"
            ]
        },
{
            "matches":  [
                "*://domain.com/student/stud_home.asp"
            ],
            "all_frames": true,
            "js": [
               "scripts/home/main.js"
            ]
        }
mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • http://stackoverflow.com/questions/5364062/how-can-i-save-information-locally-in-my-chrome-extension – juvian Jul 05 '16 at 16:48
  • @juvian i know that one, but actually attend.js file will not execute by default, we need to go to the specific url,which i dont want –  Jul 05 '16 at 16:52
  • But why you don´t add attend js to your main url after main.js – juvian Jul 05 '16 at 17:00

0 Answers0