mardi 27 janvier 2015

Requesting assistance with modifying a .js script to include opening tabs in chrome


To start things off, I have basically no javascript experience and I am trying to modify a pre-existing .js file used in my office to quickly open up several web pages from one file. It is really helpful in a quick start, and though it was written by a different person who is, unfortunately, no longer around to maintain the file, I have been able to keep it up to date with the changes that happen around here.


The downside is that the script exclusively opens the pages in IE, and there are a couple of links that I want to convert to opening in Chrome instead as they run much more efficiently there. So far I haven't been able to find the right way to code it, nor the right sort of variables/definitions to use. The original script is as follows (page addresses removed, of course, minus the last one to provide reference);



var navOpenInBackgroundTab = 0x1000;
var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.Navigate2("http://[address]", navOpenInBackgroundTab);
oIE.Navigate2("http://www.carfax.com/", navOpenInBackgroundTab);
oIE.Visible = true;


so far I have been unable to locate any examples to define a variable for chrome that will allow me to continue this format. I was hoping to make a definition like var oGC = New ActiveXObject("GoogleChrome.application"), to be able to continue the format and have a defined link open in chrome through oGC.navigate2("web page", [open in a new tab])... or something similarly simple. So far I have been unable to find a proper way to define the 'googlechrome.application' segment.


All I have found by research is that active x and chrome don't get along, and information on how to make javascript calls in HTML files for web page development, which I have been unable to apply.


Is it possible to use this script format to create a chrome call variable that will function the way this does for IE? And can it be placed in the same file or would I need to make a new .js file script to do so? or is it impossible because of Chrome's restrictions? I imagine if there is a solution that it is so stupidly simple I'll be head-desking for a week. :-P





Aucun commentaire:

Enregistrer un commentaire