Flash cs4 local security sandbox - javascript

I'm testing a flash script that calls a JavaScript function (both, the swf and the HTML file are local). The flash movie is not allowed to access the HTML file that contains the js-function.
I've learned that I have to put both files into a security sandbox, so I added the path to both files (HTML+swf) to a file test.cfg in C:\WINDOWS\system32\Macromed\Flash\FlashPlayerTrust.
But still the same problem. What to do?
thanks!

The requirement for calling from Flash to JS is that you have the allowScriptAccess parmeter set in your embedding code of your HTML document. Iirc, you can specify always or sameDomain and it will work. The second option obviously require the swf to be coming from the same domain.

Related

Inject local HTML file into webpage via Chrome Extension using iframe?

I have a HTML file that I want to inject next to each result of a Google search result page from a Chrome extension.
I was wondering if I could use an iframe to load the HTML file?
This is instead of my current implementation that uses insertAdjacentHTML() in my Content Script and a horrible long string of HTML and inline CSS. Would much prefer to have a separate HTML file with its own CSS that I can just insert instead.
I tried:
chosenElements[i].insertAdjacentHTML('afterbegin', `<iframe src="/inject.html"></iframe>`);
but just get an iframe with a 404 page because it is looking in the 'https://www.google.com/index.html' directory rather than where the file sits.
The inject.html file is in the same place as the index.html file in my build folder for the extension. How do I access it? Can I access it?
Have you tried with
src="inject.html"
instead of
src="/inject.html"

How to link javascript in html

I am creating browser based video editing tool. I want a user to first download a ~70mb javascript file and store it somewhere on his computer. I want to link that file when my website is opened. How can I achieve that.
EDIT
What i meant is that there are various files like js1.js,js2.js... all sums upto 70mb . So i will offer a zip folder to download and only link js1 or js2 file etc depending on the effects user wish to apply
i am sorry to inform you but i think there is something really wrong with what you are trying to do.
A "solution" would be to just cache the javascript on the user's browser so any subsequent requests parse the cache instead of requesting the resource again from the server.
You should know however that if you are in need to download ~70mb of a javascript file you are doing something wrong. I have a whole web app project that when published the total size is around 60mb, all files required to properly run included, and its a damn big codebase in there.
I find it very hard to believe there is ever a need for a single javascript file to be that big, in any case maybe a simple caching should do the trick
That is actually done automatically. Once you add a <script> tag with a link to a local js file (also stored on the server) the file is loaded automatically.
See HTML <script> src Attribute for more information on that.
You can only reference to js files on the server. Files on the server could look like this:
index.html
somefancyjsfile.js
You can then reference from inside your html file to the js file via the <script> tag.
I'm not sure though if the size is not a bit too much...

Obtain content of <script src="..."> tag in HTML

I have an HTML file with Javascript, that is supposed to load and process an XML file. The main obstacle is that the script may also be run locally, without an HTTP server, and also has to support Internet Explorer (11).
In normal case, I would use XMLHttpRequest, but as far as I know, it cannot be used with locally stored files (or at least doesn't work in my test cases for Chrome and IE).
I tried using <script> blocks with set src and type="text/xml" attributes and it successfully loads the content of the xml "somewhere" (the content is loaded and is visible in the network trace), but I cannot find a way, to extract the content of the xml from the <script> node.
Most sources (e.g. Getting content of <script> tag) suggests using XHR, but AFAIK it cannot be done in this case.
Is there a sensible option to implement this, without minimal http server?
I am looking for a clean solution without jQuery.

Firefox doesn't load local file in iframe

I have a file
file:///C:/Users/7%20Legged%20Spider/Desktop/test.html
When I set it into an iframe
< iframe src="file:///C:/Users/7%20Legged%20Spider/Desktop/test.html">
The iframe is blank, why is this and how can I fix it
It is because of security issue. You can not bypass it by any mean.
You should not use local file as href because of:
Security problems
"Unexpected" URLs (not everyone has C:\)
If you are using it only for development, you may want to upload the file to your server in order to include it.

any way to access data "loaded" via <script type=plaintext>

Im trying to load some code from an external domian with js. with script tags the browser is (according to firebug) loading the file. This is the code:
$('<script
type="plaintext"src="http://www.google.de"></sc'+'ript>').appendTo('body');
You cann see after loading the content of the file in this case an html document in firebug but is there any way to access this data for example with js?
No, it's not possible. It would be possible if the src were on the same domain, by using XMLHttpRequest instead.
As a side note, type should be text/plain.
No, it is not possible to get type and src work together in a script!
It is what WHATWG has stated about type when set to anything else than Javascript:
Setting the attribute to any other value means that the script is a
data block, which is not processed. None of the script attributes
(except type itself) have any effect on data blocks.
Data block is pretty useless without src - object or Blob is MUCH better. Loading something else than Javascript is not possible to access. Mime-types has no practical meaning for except the multityde of mimes to load .js (and for except Web Extension writers possibly).

Categories

Resources