How can I obfuscate javascript and html file using phonegap and android - javascript

I have a phonegap app and I want to launch it to Google play Market.
Before launch, I want to encrypt/obfuscate my code.
Please suggest me the best way to do that.

The best way to encrypt/obfuscate code for Phonegap is to actually have the native compiled code do the encrypting/decrypting.
You can find more information on how to do it here: http://www.oleksiy.pro/2011/09/20/phonegap-application-encryption/
Edit: This only works for iOS based compiles. Another similar question can be found here:
How to encrypt HTML+JS assets in Android Phonegap mobile app?
If you just need a generic obfuscator YUI compressor works well. http://developer.yahoo.com/yui/compressor/

This might be a little out of left field but one of the best ways to obfuscate your application's inner workings would be to migrate some/all of the business logic to a server-side web-service.

Related

How to access UWP JS APIs in a UWP C# app?

We have a bunch of JavaScript code that uses UWP APIs that was written for a UWP Javascript app (.jsproj). Now this app is rewritten as a UWP C# app.
The UWP APIs in C#, JS and C++ are similar enough, see these examples for ApplicationData.LocationSetting, so migrating the code would not be that much of an effort - but it would still be work that has to be done.
Is there a way so that I do not have to rewrite all our JavaScript code in C# to be able to use it in our rewritten app? Can I somehow use the UWP JS APIs in a UWP C# app?
I was hoping I could use a simple webview to somehow access the APIs (my thinking was that the UWP JS app basically is just a webview), but in my testing I could not access them there.
Although I totally agree that JavaScript code looks similar to C# code. I'm afraid you cannot get what you want like your first post mentioned. The webview control is lightweight and I don't think it is possible for this control to include all required components for your js code to run.
If you've wrote some code in Windows Runtime Component before, like this doc Walkthrough: Creating a Simple Windows Runtime component and calling it from JavaScript mentioned, then you can reuse the Windows Runtime Component. But if you haven't done this, then I'm afraid you have to rewrite your code in C#.
Well, by the way, I believe you will find C# code is easy for you to write since there are more UWP C# demos then UWP JS demos.
This never got a proper answer, but the correct answer is to use the now-deprecated JSRT apis. These can be found here, and an old blog post about them to provide some understanding can be found here.
Obviously this isn't as useful anymore with the deprecation of Spartan Edge, but still can be helpful when there's no alternative options.

Nativescript core OCR plugin

I'm trying to develop an ocr app with the Nativescript plugin:
https://market.nativescript.org/plugins/nativescript-ocr
https://github.com/EddyVerbruggen/nativescript-ocr
and it seems that the example doesn't works or I'm doing something wrong. I read something about Firebase ML kit but I have no idea about that and if it works offline (Offline work is a must for me).
https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/ML_KIT.md
Could be deprecated the first plugin?
might I use firebase?
could it use with nativescript core (only js)?
It works offline?
Any idea about how to start?
Yes, the OCR plugin is kind of deprecated, not actively maintained anymore.
Firebase ML-Kit is recommended and it has different methods you could use for text recognition, one works on device and another on cloud. Refer the same read me you have linked in your question.

Is it feasible to load 'code logic' dynamically in iOS app?

I am looking at this WWDC session: Integrating JavaScript into Native Apps
My understanding is that this is a bridge between Obj-C and javascript, that allows calling javascript code from Obj-C and vice versa. I am wondering, does this mean I can dynamically load my 'code logic' from server in javascript, like in web applications? How should I structure my code so that a large part of my code is in javascript (Obj-C is still needed to drive the js code, of course).
If this is feasible, then deploying changes to iOS projects would no longer be such a painful experience(waiting for review and user upgrade,etc), development could be more agile. I know some teams use phonegap and similar frameworks just to get this advantage, but those solutions doesn't get the most of iOS native UI widgets/features.
If both data and logic can be loaded from server, and the Obj-c part is just the (relatively) stable skeleton code, then iOS apps become web apps without HTML (consider the app a customized web browser which loads code and data from server).
So my question is: how feasible is this? How should I split the code between Obj-C and js to make this as flexible as possible?
As per Appstore Review Guidelines "Apps that download code in any way or form will be rejected"

Converting an HTML/Javascript Project into an Executable

So I'm working on a just for fun project to get practice using HTML/CSS/Javascript.
I'm using Aptana to write all my code and it is currently set up to run and work in a browser (obviously) it's a text adventure game.
It would be really cool though to be able to compile the code into an executable file that runs in its own window, not in a browser.
Is this something relatively easy to accomplish?
Thanks in advance for any help! :)
FF and Chrome provide a function to run a custom website in an app mode. That means no menubars, no addressbar and a complete window for the website. Maybe this is already what you are looking for.
http://www.rarst.net/software/dedicated-web-app-window/
https://superuser.com/questions/33548/starting-google-chrome-in-application-mode
https://superuser.com/questions/171235/does-internet-explorer-have-something-equivalent-to-chromes-app-mode
But if you are interested in compiled code for speeding up your game, this is not the way to achieve this.
For Windows as OS
see http://www.autoitscript.com/autoit3/docs/libfunctions/_IECreateEmbedded.htm
AutoIt is a scripting language for basically everything (with automation). SciTE is the editor to go.
In the example of the _IECreateEmbedded function, just change:
_IENavigate($oIE, "http://www.autoitscript.com")
to
_IENavigate($oIE, "file://.../thegame.html")
Very simple, you just have to copy-paste it and build it - you can even build it Online: AutoIt Online Compiler
There are many different ways you can acheive this.
If you're only targeting windows machines, then creating a HTA would be the simplest approach.
The modification to the structure of your existing code would be minimal, its essentially changing the file type and adding an extra couple of tags in. If you wanted a single file, instead of an exe and any resources (images etc) that you use you would have to base64 encode your images, and insert external scripts into the main page.
for information about embedding images and icons into a hta: http://www.john-am.com/2010/07/building-a-self-contained-hta-with-embedded-images-and-icons/
You could also use AppJS, node-webkit or similar type projects, but they would add around 30MB of stuff thats not being used.

Converting HTML + JavaScript to an exe

There is actually a topic asking a very similar thing, however the information there is either out of date (broken links, discontinued solutions) or not suitable for my needs.
I have a showcase for my graduation wherein we have the opportunity to display our work to potential employers. The interface we have to use only allows .jpg, .flv and .exe files, however my project is in HTML / CSS / JavaScript.
Is there any way I can convert my project into a .exe?
(The ways the pre-existing question's answers suggest creating an .exe are now broken links / discontinued as far as I can tell; and alternate answers suggest ways to create standalone applications which do not generate .exes, which are not fit for my purposes)
Cheers!
Most easiest way is:
1) Download Visual Studio Express Edition(Because it's free).
2) File -> New Project -> Windows Forms Application.
3) Load your current HTML into it.
4) Add WebBrowser control to your project.
5) Deploy your application(Build -> Publish).
Note:
The WebBrowser Control use IE by-default. Take a look at this alternative as well.
Welcome to 2019!
There's all kinds of different ways to accomplish this now. One popular npm package is npm pkg. There's also the popular Electron (this is what vscode was built on), and quite a few others
You Could always turn the HTML file into a HTA file and then convert it into an exe :)
https://www.vbsedit.com/
You can create a Windows app from HTML/JS.
Actually it's one of my pet projects:
Scriptonit
I've been using it for a while to create tools for myself, but just recently I decided to make it a proper freeware product. If you're not looking for something very complex and you don't need lots of frameworks & modules, this might be just what you're looking for.
You can download Scriptonit here.
You may try creating a .exe installer to you html file using Inno Setup.
You can use the setup wizard; just select the html file instead of exe when selecting the main exe file
It works somehow like an installed application, it will open in your browser but you can see in the List of Applications. (in control panel)

Categories