This question already has answers here:
How to go about debugging JavaScript in the HtmlService in Google Scripts
(2 answers)
Closed 5 months ago.
I have issues with my client-side code (who doesn't, with any code they write in any language, at one point or another in the development process?) Problem is that I'm writing this code in Google Apps Script, and can't find the js code I am trying to debug/examine for errors. I remember being able to enter a function name, and then click on the returned code to go straight to the code file, and the function in it, but that, for some reason, isn't working here. I try it and this is what I get taken to:
(I think Caja might have something to do with this...)
I think it's in some VM**** file, but I don't know much about that. How to access that JavaScript code to set some breakpoints?!
From answer to how can I debug client side javascript (in html pages) in google appscripts
Unfortunately, there is no other good way to debug client side web UI other than with console logs. As you noted the JavaScript/DOM is re-written so you can't use standard Chrome debug tools.
Because of the above, consider using the approach suggested by Mogsdad on Did you know? (You can log to a spreadsheet from client JavaScript!): Write debugging logs to a spreadsheet.
what about 'debugger'?Write it in the code
Related
We have a web application built with C# and ASP.NET. I have to reference a few .NET session variables in my JavaScript code, so I use the following line to do so:
var layoutID = '<%=Server.UrlEncode(string.Format("{0}", Session["layout_id"]))%>';
This works just fine. The web application is built and published to our web server. If I want to make a change, a .NET change would require me to compile the changes and publish it to the web server again. If it's a JavaScript change, I can simply edit the js in the .ASPX page and the fix is immediately picked up...no compiling needed.
My question - what if I make a change to this inline C# code contained in JavaScript? Say, for example, I meant to access Session["layoutid"] without the underscore. Could I just edit the .ASPX page on the web server, or will this require compiling just as if it were in a .CS file? I'm guessing since it's C#, I will still need to compile for the change to be picked up. And yes I could just try it and see for myself, but I was hoping someone could give a little insight into what goes on behind the scenes with this inline c# code. And while we're on the topic, is the technique I'm using to access .NET sessions variables in JavaScript the most efficient way to do it?
Bonus question - what is this technique called? I tried searching for an answer but I wasn't sure what to search for other than "in-line c# code JavaScript".
Thanks!
No, changes to ASPX/CSHTML files don't require re-compilation.
Note: whether it is good idea to jump on production server and change random code bypassing source control/testing is question to discuss and answer by your team.
This question already has answers here:
Convert a PHP script into a stand-alone windows executable
(7 answers)
Closed 9 years ago.
I want to make windows standalone app with php, even i want to use database, javascript in that application.
Note : i don't want to give source code to user.
I should be like exe file which user can run.
If going with Windows, try WinBinder. It allows you to develop native Windows applications using PHP.
It also supports SQLite, so you don't need a database server
Also this answer will help you
I use phc to create .exe files out of my PHP source code. It works quite well, but it's mostly good for console applications rather than full webpages.
However, you could have your PHP script include a basic "server" that allows the browser to communicate with it - I have done this in the past too, and while it might seem daunting the results were very rewarding.
This question already has answers here:
How do I hide javascript code in a webpage?
(12 answers)
Closed 9 years ago.
I have a site where I display charts using JS data. I don't want other people to copy my source (meaning have them copy paste my html/JS, etc.). I have seen other websites with charts and if you view the source there is no data there. Are they doing something sneaky? How do I do that? Can you run it on the server side? Can you put it in another file and reference that one? I have the JS linked from an external file but you can still see all the a data in that one if you open it. What is the best way to keep the data from appearing in the source file? I'm not talking about obfuscating it.
Please read this related post:
This thread: How do I hide javascript code in a webpage?
Basically, if a web browser can read it, the end user can access it.
If you wanted to really make it more work to view the source, you would do all of the following:
Put it in an external .js file.
Obfuscate the file so that most native variable names are replaced
with short versions, so that all unneeded whitespace is removed, so
it can't be read without further processing, etc...
Dynamically include the .js file by programmatically adding script
tags (like Google Analytics does). This will make it even more
difficult to get to the source code from the View Source command as
there will be no easy link to click on there.
Put as much interesting logic that you want to protect on the server
that you retrieve via ajax calls rather than do local processing.
You can't hide your JavaScript since it has to execute client side. You can move all your js to external files, but that will not really hide it since someone can just reference the same files.
Basically the key point is that nothing done in JavaScript can be kept a secret from a skilled developer. JavaScript is inherently in plain text.
This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
Closed 8 years ago.
I have written a lot of functions which use ajax to call PHP functions in my main.js file. The problem is that anyone can see my logic and internally called php file names of website by viewing the page source. How should I prevent the people from viewing my javascript file?
Javascript can be obfuscated, but there's nothing that's going to prevent a client from
seeing the URL strings in your code, or
simply inspecting the HTTP requests themselves to determine what URLs are being hit.
This re-enforces the importance of making sure you write solid and secure server-side code. You also want to make sure your web server is configured and secured properly, so that (for example) clients are unable to download the PHP source directly.
You can't stop people from viewing your javascript file, because the readable javascript code is required to correctly execute that code on your page. You can obfuscate the function names and minify the javascript to make it harder to read, but if someone wants to read the file, this will not stop them from doing so.
Instead, you should assume that everyone knows everything about your javascript file, and that everyone is able to alter your javascript file. You shouldn't put any validation solely in your javascript file and in every php page you should somehow check if the request that is made is valid (e.g. was the user allowed to do an ajax request to a certain page at a certain time?).
You can't able to hide the Javascript in browser, If you did that, your javascript related operations won't run.
you cannot hide javascript files. but you can minify the code so that, it will be very difficult for a man to read and understand your logic and all.
something like this
http://code.jquery.com/jquery-1.10.1.min.js
From last 2 weeks I am searching for an answer but not getting a bit of success.
My scenario is, I am using Eclipse for developing Android apps. I want to display route directions (Driving, Walking, Bicycling) between two dynamically entered addresses on Google Maps... I want to make use of Google Maps JavaScript API V3 Services, because of all its awesome functionalities...
http://code.google.com/apis/maps/documentation/javascript/services.html#Directions
I was suggested by some developers on Stack Overflow and they gave this link http://code.google.com/intl/en/apis/maps/articles/android_v3.html#why But this site has code that uses some JavaScripts in the code, if this site is having the correct stuff, where am I supposed to write JavaScript in my eclipse android app because AFAIK code written in eclipse uses only Java framework.. If that site is not a good bet give me some other links that demonstrates with examples...
I am not sure I follow you. On the link provided earlier on SO, I see the Java code:
http://code.google.com/intl/en/apis/maps/articles/android_v3.html#why
That actually uses Android SDK support for Google Maps. If you still want to use the Javascript, you will have to go through WebView. I would otherwise recomment the way it is followed here:
http://code.google.com/intl/en/android/add-ons/google-apis/maps-overview.html
This page was linked to the previous link mentioned above and it uses Java not Javascript.
You do not need to worry about javascript. The MAP_URL (http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html) in WebMapActivity has this javascript in the page. So Either you can write your own html page with that javascript (hosted on your server) or you can simply load the MAP_URL into your webview without worrying about javascript.