While submitting an extension to the Chrome Store this question is asked regarding remote code:
("All JS, Wasm or CSS that are not part of the administration package
are remote code. This also includes references to external processes
in tags, modules that refer to external personal and strings
determined via "eval ()".)
In the case of my extension I don't use eval(), or directly inject other scripts libraries, I just put an iframe that will have its own libraries.
Should I report this behavior remote-code?
Code to add the data
const iframe = document.createElement('iframe')
iframe.src = `URL STRING`
iframe.id = 'Frame'
document.body.appendChild(style)
document.body.appendChild(iframe)
Related
I am trying to use Jwrapper to replace the java applet as chrome is blocking the Java applet.
So please suggest the best way to integrate the Jwarpper app in javascript and best way to deploy.
Regards,
Mukesh Gupta
When you build an app using JWrapper it will produce, amongst other files:
MyAppNameEmbed.js
MyAppNameExample.html
You can copy all the files in the build directory including the ones above and make them available on a web server / website.
You can then take the URL of the JS file above, and use the code in the example HTML file above to point it to your JS file. For example:
<script
id = "jwEmbed"
src = "http://www.example.com/myappname/MyAppNameEmbed.js"
showImage = "yes"
showAppName = "yes"
configuration = "offline*"
type = "text/javascript">
</script>
You can get the exact HTML code to use from your example HTML file in your build folder. This will create a block in your web page which autodetects the end user operating system and provides an appropriate download button which then links to the executable app files you uploaded (along with the JS and HTML files) to your website.
I'm attempting to modify/override functionalities of the CQ client library manager and I was wondering if anyone is familiar with where the code lives?
I've found some js that controls channel detection in DefaultChannelDetector.js and CQClientLibraryManager.js which seemingly only deals with channels, not dependencies or embedding. These are served as a clientlib, etc/clientlibs/foundation/librarymanager.js which I assume can be overriden by pointing htmllibmanager.clientmanager in apps/system/config/com.day.cq.widget.impl.HtmlLibraryManagerImpl.config
So for modifying, I would need to know where the code lives. For overriding, I assume I point the htmllibmanager.clientmanager toward something else but I would still need to know how to access dependencies/categories/embed properties of clientlibs.
Additionally, any low-level insight into how the cq:includeClientLib tag works would be appreciated. (low-level as in point to the code that implements it)
The vast majority of the Client Library functionality is in the HtmlLibraryManager component implemented OOB by the HtmlLibraryManagerImpl class in the com.day.cq.cq-widgets bundle. You can look up this component in Felix to see what bundle it is in and then decompile that bundle if you need to look at the guts of what the implementation does.
At a high level this component handles both the generation of the results of the cq:includeClientLib tag and the concatenation and compilation of libraries when a library URL is requested. Speaking specifically to the cq:includeClientLib tag, the HtmlLibraryManager's writeIncludes method will determine, based on parameters of the request and parameters provided in the cq:includeClientLib tag, how to write includes to the page for the existing libraries.
In the case of dynamic libraries (libraries which are channel based) it will write calls to the library manager JavaScript mechanisms which will dynamically include libraries based on the user's channel. Otherwise appropriate script and link tags for JavaScript and CSS respectively will be written for the requested libraries and their dependencies.
So I created an ASP.NET 4 application in VS2010, that needs to play sound to the end user, and it is working perfectly in my local development environment. The problem is the sound resource nor the Resources.resx is not being published to the server. Any idea why?
What I did:
1) Under Project Properties Recources I added my sound resource called: soundbyte (containing soundbyte.wav). I noticed this creates a Resource folder with the wav file and under my project a Resources.resx file referencing the file
2) In my code I play the file as follows:
Dim audioFile = My.Resources. soundbyte
Dim player = New Media.SoundPlayer(audioFile)
player.Load()
player.Play()
In the Visual Studio Solution Explorer right-click on Resources.resx and select Properties. Build Action. Set to content.
EDIT: The following resource might also help.
http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx
Ultimately, I found a way to play the sound to the client browser (as opposed to the server the asp app is running on) was to follow the techniques in this example: http://www.vbdotnetheaven.com/UploadFile/scottlysle/PlaySoundsInASPX09032006083212AM/PlaySoundsInASPX.aspx
But I found an even better way in my case was to use Javascript, which doesnt' require the Resources technique.
simply embed the sound on the page after the tag:
<embed src="Sounds/jump.wav" autostart=false width=1 height=1 id="sound1" enablejavascript="true">
Then in javascript setup the function:
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
Finally play the sound in the browser as needed in Javascript:
EvalSound('sound1');
I'm working with modules and each of it will be compiled (deployed) in a common folder in a webproject. In the main class I defined an array of module paths which I need for loading all these defined modules.
How can I make that more dynamically, for instance, I want to say, load all modules in a certain folder an its subfolders without to know each module by name.
You can't do anything in a Flex/AS3 related browser based app to get information about folders on the server.
You're going to have to write a server side service to get the information. Any technology should work, such as .NET, ColdFusion, PHP, Java, or whatever. Then just call the service, and it should send you back the information you need. In ColdFusion, you'd use the cfdirectory tag.
I would like to give my CSS and javascript files far-future headers and add a token onto the URLs referrring to them. That way browsers don't have to re-download CSS and javascript unless I've released a new build of the site.
http://example.com/css/styles.css?build=23424
How can I pass a build number or timestamp to my code-behind so it can add the timestamp?
Obviously C# doesn't have macros, which is what I would use in C/C++.
I realise that this will force browsers to download assets whenever I do a new build - regardless of whether or not the build involved changing the assets. However, I would like to put a simple scheme in place before I implement anything more advanced like looking at individual file modification times.
Here's a bit of code that I use to extract the build id from the current assembly at application start. It reads the version number from the assembly, a version designator (dev/qa/blank) from the web config, then constructs a version number string to stuff into the application. This code goes in Global.asax.cs. You can then refer to it in your markup from the Application instance.
var webAssembly = Assembly.GetAssembly( typeof(...known class...) );
var designator = WebConfigurationManager.AppSettings["VersionDesignator"];
string version = webAssembly.GetName().Version + designator;
this.Application.Add( "Version", version );
Here's an example of how you could use it in an MVC context (sorry I don't have any WebForms examples).
<link type="text/css" rel="stylesheet"
href="/Content/styles/screen.css?build=<%= this.Application["Version"] %>" />
Interesting idea.
Here's one way to do it:
Go into your AssemblyInfo.cs class under the Properties folder in your project.
Change your assembly version to include the star wildcard: [assembly: AssemblyVersion("1.0.*")].
In your code, you can retrieve the current build version like this:
_
var buildNumber = Assembly.GetExecutingAssembly().GetName().Version.Build;
_
That's it, you're done.
Changing the AssemblyVersion to 1.0.* will cause Visual Studio/MSBuild to increment the build number automatically for you each build. Then, you can access this build number at runtime using the above code snippet. Easy as cheese.
Browsers and servers know how to handle caching via HTTP. So, I misunderstand, what are you trying to accomplish with providing this kind of caching. A browser will not re-download your CSS and Javascript if it has seen it recently. And it will re-download it if you do a push of your new build on the server. See cache headers like Cache-control and Expires etc. Here's a tutorial http://www.mnot.net/cache_docs/