Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > JavaScript Import file problem

Reply
Thread Tools

JavaScript Import file problem

 
 
Joseph Scoccimaro
Guest
Posts: n/a
 
      11-21-2005
I am using greasemonkey to create a script that allows one to analyze a
web page. Currently I am trying to import the javascript from an
external file to add to the DOM of a web page. It is giving me this
error: Security Error: Content at http://www.google.com/ may not load or
link to file:///home/majin/8903/greasemonkeyscript/metaanalysis.js. Is
there a way to get around this? Here is the code I am using:

metaAnalysis: function(scriptSource) {

var theHead = document.getElementsByTagName('head')[0];
var metaAnalysisScript = document.createElement('script');
metaAnalysisScript.type = 'text/javascript';
metaAnalysisScript.src = scriptSource;
theHead.appendChild(metaAnalysisScript);

} //end metaAnalysis()

metaAnalysis('file:///home/majin/8903/greasemonkeyscript/metaanalysis.js');
//this is the calling function.


Joseph Scoccimaro
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      11-21-2005
Joseph Scoccimaro said the following on 11/21/2005 11:31 AM:
> I am using greasemonkey to create a script that allows one to analyze a
> web page. Currently I am trying to import the javascript from an
> external file to add to the DOM of a web page. It is giving me this
> error: Security Error: Content at http://www.google.com/ may not load or
> link to file:///home/majin/8903/greasemonkeyscript/metaanalysis.js. Is
> there a way to get around this?


The only way is to stop trying to script cross-domain. It appears you
are trying to append the script file into a google.com page from your
hard drive. That is a serious serious security issue that you can't get
around in a normal default security environment.

If you want to access the data on www.google.com for analysis, you would
do better to have a local HTML file that uses an HTTPRequestObject to
retrieve the contents of google.com and then display it in your own page.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem(s) with import from parent dir: "from ../brave.py import sir_robin" per9000 Python 7 02-27-2006 06:36 PM
to use import java.lang.* or import java.lang.Math or none at all? JPractitioner Java 13 02-24-2006 08:48 PM
XML Schema question - does "import" import elements? Vitali Gontsharuk XML 2 08-25-2005 07:33 PM
Problem with import "from omniORB import CORBA, PortableServer" Stefan Seefeld Python 3 04-11-2005 08:54 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM



Advertisments