This question already has answers here:
HTTP GET request in JavaScript?
(31 answers)
Closed 6 years ago.
I want to send an async HTTP request from the HTML, parse a response, and update an HTML page respectively. Is there a way to do it without using AJAX or any other third-party library?
I'd like to find the most basic way to do this.
Since libraries can do it, it should be possible without them too.
Worth saying, that I'm a mobile developer who checks web development for a couple of days.
UPDATE 1
I didn't have to call AJAX a "third-party library". My bad.
UPDATE 2
Thanks everybody who responded. What I've learned: the only way to do what I wanted is AJAX, in particular, XMLHttpRequest.
There is no way without JS. The most basic way is to either use the new fetch() API, or good old XMLHttpRequest() link
This question already has answers here:
Deobfuscating Javascript [closed]
(5 answers)
Closed 8 years ago.
How to un obfuscate java-script code like that : it takes alot of time to know the expression obfuscate for the javascript to protect the code , but I'm tring to get the main code of this script but don't know How ?
var _0x843d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x53\x4C\x41\x4D\x52","\x6E\x61\x76","\x72\x65\x73\x69\x7A\x65","\x77\x69\x64\x74\x68","\x74\x6F\x70\x2D\x6E\x61\x76\x2D\x63\x6F\x6C\x6C\x61\x70\x73\x65","\x68\x61\x73\x43\x6C\x61\x73\x73","\x2E\x6E\x61\x76\x62\x61\x72\x2D\x66\x69\x78\x65\x64\x2D\x74\x6F\x70","\x61\x64\x64\x43\x6C\x61\x73\x73","\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73","\x74\x6F\x70","\x6F\x66\x66\x73\x65\x74","\x2E\x6E\x61\x76\x62\x61\x72","\x73\x63\x72\x6F\x6C\x6C","\x64\x72\x6F\x70\x64\x6F\x77\x6E","\x61\x63\x74\x69\x76\x65\x2D\x73\x75\x62","\x65\x61\x73\x65\x4F\x75\x74\x45\x78\x70\x6F","\x3A\x6E\x6F\x74\x28\x2E\x65\x78\x29","\x6F\x6E\x65\x50\x61\x67\x65\x4E\x61\x76","\x2E\x6E\x61\x76\x62\x61\x72\x2D\x6E\x61\x76\x20\x2E\x64\x72\x6F\x70\x64\x6F\x77\x6E","\x61\x63\x74\x69\x76\x65","\x2E\x6E\x61\x76\x62\x61\x72\x2D\x6E\x61\x76","\x73\x6C\x69\x64\x65\x44\x6F\x77\x6E\x48\x65\x61\x64","\x2D\x35\x30\x30\x70\x78","\x30","\x63\x73\x73","\x2E\x70\x61\x67\x65\x48\x65\x61\x64","\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x31\x2C\x20\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x33","\x72\x65\x61\x64\x79","\x30\x70\x78","\x31","\x65\x61\x73\x65\x4F\x75\x74\x43\x75\x62\x69\x63","\x61\x6E\x69\x6D\x61\x74\x65","\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x33","\x2E\x70\x61\x67\x65\x48\x65\x61\x64\x20\x2E\x68\x65\x72\x6F\x20\x68\x31","\x64\x65\x6C\x61\x79","\x73\x74\x6F\x70","\x6C\x6F\x61\x64","\x70\x61\x72\x61\x6C\x6C\x61\x78","\x74\x6F\x75\x63\x68","\x73\x65\x74","\x72\x61\x6E\x64\x6F\x6D","\x69\x6E\x69\x74","\x70\x72\x65\x6C\x6F\x61\x64\x65\x72","\x6F\x76\x65\x72\x66\x6C\x6F\x77","\x76\x69\x73\x69\x62\x6C\x65","\x62\x6F\x64\x79","\x66\x61\x64\x65\x4F\x75\x74","\x23\x70\x72\x65\x6C\x6F\x61\x64\x65\x72","\x73\x6C\x69\x64\x65\x72","\x73\x75\x70\x65\x72\x73\x6C\x69\x64\x65\x73","\x6F\x77\x6C\x43\x61\x72\x6F\x75\x73\x65\x6C","\x65\x61\x63\x68","\x73\x6B\x69\x6C\x6C\x62\x61\x72","\x61\x6E\x69\x6D\x61\x74\x65\x64","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x74\x65\x73\x74","\x64\x61\x74\x61\x2D\x70\x65\x72\x63\x65\x6E\x74","\x61\x74\x74\x72","\x2E\x73\x6B\x69\x6C\x6C\x62\x61\x72\x2D\x62\x61\x72","\x66\x69\x6E\x64","\x68\x65\x69\x67\x68\x74","\x6F\x75\x74\x65\x72\x48\x65\x69\x67\x68\x74","\x77\x61\x79\x70\x6F\x69\x6E\x74","\x2E\x73\x6B\x69\x6C\x6C\x62\x61\x72","\x76\x69\x64\x65\x6F\x42\x67\x59\x54","\x74\x75\x62\x75\x6C\x61\x72","\x3C\x69\x6D\x67\x20\x73\x72\x63\x3D\x27\x69\x6D\x67\x2F\x62\x67\x2D\x68\x65\x61\x64\x2D\x31\x2E\x6A\x70\x67\x27\x20\x61\x6C\x74\x3D\x27\x27\x20\x2F\x3E","\x68\x74\x6D\x6C","\x62\x6F\x6F\x74\x73\x74\x72\x61\x70\x43\x61\x72\x6F\x75\x73\x65\x6C","\x63\x61\x72\x6F\x75\x73\x65\x6C","\x66\x69\x74\x56\x69\x64\x73","\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F\x46\x69\x6C\x74\x65\x72","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","\x63\x75\x72\x72\x65\x6E\x74","\x64\x61\x74\x61\x2D\x67\x72\x6F\x75\x70","\x61\x6C\x6C","\x69\x6E\x61\x63\x74\x69\x76\x65","\x2E\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F\x2D\x6C\x69\x6E\x6B","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x2C","\x73\x70\x6C\x69\x74","\x63\x6C\x69\x63\x6B","\x68\x6F\x76\x65\x72","\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F","\x70\x6F\x72\x74\x66\x6F\x6C\x69\x6F\x45\x78\x70\x61\x6E\x64\x65\x72","\x73\x63\x72\x6F\x6C\x6C\x41\x6E\x69\x6D","\x79\x65\x73","\x64\x65\x66\x61\x75\x6C\x74\x73","\x66\x6E","\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x64\x61\x74\x61","\x64\x61\x74\x61\x2D\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E","\x64\x61\x74\x61\x2D\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E\x2D\x64\x65\x6C\x61\x79","\x61\x6E\x69\x6D\x61\x74\x69\x6F\x6E\x2D\x64\x65\x6C\x61\x79","\x20\x76\x69\x73\x69\x62\x6C\x65","\x25","\x2E\x61\x6E\x69\x6D\x61\x74\x65\x64","\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x66\x69\x78\x65\x64","\x2E\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x2D\x6D\x69\x64\x64\x6C\x65\x2D\x66\x75\x6C\x6C","\x6D\x61\x67\x6E\x69\x66\x69\x63","\x6D\x61\x67\x6E\x69\x66\x69\x63\x50\x6F\x70\x75\x70","\x63\x6F\x6E\x74\x61\x63\x74\x46\x6F\x72\x6D","\x63\x6C\x69\x63\x6B\x20\x74\x6F\x75\x63\x68\x73\x74\x61\x72\x74","\x64\x69\x73\x61\x62\x6C\x65\x64","\x70\x72\x6F\x70","\x3C\x69\x20\x63\x6C\x61\x73\x73\x3D\x27\x66\x61\x20\x66\x61\x2D\x63\x6F\x67\x20\x66\x61\x2D\x73\x70\x69\x6E\x27\x3E\x3C\x2F\x69\x3E\x20\x53\x45\x4E\x44\x49\x4E\x47","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x73\x75\x62\x6D\x69\x74","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D","\x73\x65\x72\x69\x61\x6C\x69\x7A\x65","\x50\x4F\x53\x54","\x69\x6E\x63\x2F\x63\x6F\x6E\x74\x61\x63\x74\x2E\x70\x68\x70","\x6A\x73\x6F\x6E","\x73\x74\x61\x74\x75\x73","","\x76\x61\x6C","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x20\x69\x6E\x70\x75\x74","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x20\x74\x65\x78\x74\x61\x72\x65\x61","\x65\x6D\x70\x74\x79","\x23\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x2D\x72\x65\x73\x70\x6F\x6E\x73\x65","\x3C\x69\x20\x63\x6C\x61\x73\x73\x3D\x27\x66\x61\x20\x66\x61\x2D\x63\x68\x65\x63\x6B\x27\x3E\x3C\x2F\x69\x3E\x20\x53\x55\x42\x4D\x49\x54","\x61\x6A\x61\x78","\x6F\x6E"];
I have another question related to that , Could I use this script as it's or I have to decode it to use at my HTML5 page ?
The point of obfuscation is to make it very challenging to restore the original code as written while maintaining the same functionality. So to answer your first question there really is no way to get back to the original code as the author clearly didn't want you to see it or be able to edit it. To answer your second question yes you should be able to use it normally assuming it was properly obfuscated.
I suggest you do a little reading on the topic: http://en.wikipedia.org/wiki/Obfuscation_%28software%29
There might be a few deobfuscation tools out there for javascript, but the chance that these work well is probably low.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Is it possible to hide or scramble/obfuscate the javascript code of a webpage?
Is there any way to hide the view of JavaScript code from the view page source action?
No. You can obfuscate it a lot, though.
No. It is the same with any content on the web. If you can see or hear it, you can download it.
No.
If you have sensitive algorithms or implementations, run them on the server and access them through Ajax or at the time the page is requested. Keep the javascript on your page UI-centric.
You can hide your js code to unexpert eyes using obfuscate techniques: JS obfuscate but an expert js coder can reverse engineering and understand it
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I obfuscate JavaScript?
Hi there, is there any way to encrypt code written in javascript, that's displayed in the browsers window..
The below link has a similar discussion and has answer to that.
How can I encrypt JavaScript code so that it's not decryptable?
Hope this will be helpful.
You mean that you want to obfuscate your javascript code so that others cannot read it properly?
Try jCompress or any other Javascript Minifiers
There is no way to encrypt (because otherwise the browser couldn't run the code) but you can obfuscate. Just search for 'Javascript Obfuscator' .
I wouldn't recommend this though, as obfuscators can cause bugs and it is possible to deobfuscate them.
Is there any reason why you want to encrypt the javascript?
If you mean a way to encrypt it so it can't be stolen than the answer is no. The browser needs to be able to read the code to be able to execute it. There are tools to make it harder to read for humans but in the end you can't avoid people stealing your code.
Plenty of tools available on google. 1 Example: click
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I obfuscate JavaScript?
I have been working on a web app in JavaScript. Nearing complete.
How do I protect me JavaScript code from someone copying it? I mean if you view my page source, it references the .js files and one could really steal these.
Should I be using something else? RoR?
Does Google Maps have a RoR API?
Your closest bet would be to use something like
A Javascript Obfucator
A Javascript Minifier
A Javascript Packer
People will still be able to steal and use your code though, it will just be harder to modify.