473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

JavaScript Import file problem

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
gt*****@mail.gatech.edu
Nov 23 '05 #1
1 3394
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/
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for...
22
by: Weston C | last post by:
I know of course that you can use <script src=""></script> in an HTML document to include javascript code you don't want to spill all over the page. I'm wondering if there's a way to include...
25
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low...
3
by: Casper Hornstrup | last post by:
I have an ASP.NET application that imports product descriptions from an Excel file. The Excel file is uploaded, then a background thread will start importing the product descriptions from the Excel...
2
by: makthar | last post by:
hi i have the following java applet progam and the javascript the problem is that when the javascript tries to access the applet method it gives me an error as follows document.form1.myApplet is...
2
by: neeebs | last post by:
Hi, I'm not sure if this is a javascript problem per se, but here goes. I have an xsl document with a python function defined within a <script> block. Elsewhere in the xsl file, within a python...
2
by: ManidipSengupta | last post by:
Hi, a few (3) questions for the Java experts, and let me know if this is the right forum. It deals with 100% java code (reason for posting here) but manages a Web browser with Javascript. Thanks in...
15
by: maxin | last post by:
Hi, I write a javascript function in xsl (UOMConversion.xsl) as follow: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <script...
2
by: JohnLorac | last post by:
Hello, I'm trying to load and write file on local disc drive using signed javascript file. But I have experienced problem running this url: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.