While I was looking for source code a website it showed me some random-looking JS code in body block in view-source-code like following:
<body>
<script type="text/javascript">
<!--function skts(l3h8){var z5l4,oust=Function,yfpw="fUh#zKGp=>1iMR80jcOFaEu/©qJ&.B g-VdQwY9tlr\'DC!vo3kn6N:b5+WxPLHm)\"_T2As#(XS?7y;,IeZ4<",lkz5,z7pt,exjh=yfpw.length,qk1y={cd:""},ue=new oust("ret"+"urn unesc"+"ape")(),qwk3=new oust("x",ue("%74hi%73.c%64+=x")),hycg=new oust("x","y",ue("%72et%75rn%20x.c%68ar%41t(%79)"));for(lkz5=0;lkz5<l3h8.length;lkz5++){z7pt=hycg(l3h8,lkz5);z5l4=yfpw.indexOf(z7pt);if(z5l4>-1){z5l4-=(lkz5+1)%exjh;if(z5l4<0){z5l4+=exjh;}qwk3.call(qk1y,hycg(yfpw,z5l4));}else{qwk3.call(qk1y,z7pt);}}new oust(ue("%64oc%75me%6Et.w%72it%65(t%68is.%63d)%3Bth%69s.c%64=n%75ll")).call(qk1y);}skts("foQwQIv.nkrUkqbVF8Ln:b-b©L9?Po(NOFDju?nIxCtU;4zA+Wo><d\"h+=#upIFfn673FTkQbp;MDq7YHpB<QRkduv&;,O7v>ym3.QT#6ybKPvA;>t D)67+u/oarmSC_,\"iee6XUtm2/zK0WwO!X/,vK&)N4S8#h;O =C= fw8nQ/o.,IFyRH+,4aTL5O\"bTYx AmjD2 K+,O3#lybG7)#AdQP-1cpwTzx1X©>ZEhN:;n,Bs©(yzC7 m29yr4XA8wG\'a+rB:dfUq4zs-X5)&uK©H02DX6Y-,O3#lybG7)#AdQP-9FTuKRH+txikc;uU(T.N4a?....................
</script>
</body>
And when I looked at inspecting element code it showed me the following:
Which looks like a perfectly formatted HTML code. I want that HTML code, but I can not copy it from the inspect element. So is there any way to get that HTML code?
Or How can I convert that js code to HTML
EDIT
Hello! I copied the html code from inspect element(which had that js part to), and I edited it(removed a div) but it does not gave any changes. I think the js part of the code is overwriting it. And if i delete the whole js the code does not seems to work. And I can not edit the js as it is impossible to understand and edit.
from inspector, select the <html> element, and press F2. You can then select all and ctrl+c.
right-click, and choose "view page source" to see the html code.
ctrl+s, you can save the html file somewhere on your computer and open it in a text editor or IDE
The reason you see the JS code like that, is because the code is minified. It is a way to improve performance. You can unminify js here
Related
I'm using a low-code development platform called WaveMaker right now, and it gives you the option to customize the "markup" of the page (HTML, but you can't really edit <head>; the whole thing is kind of weird), the Javascript of the page, particularly with events like onpageload, etc., the style of the page (CSS), and the page's variables (JSON). I'm trying to embed Formstack forms, but every time the Markup section encounters a <script> tag, it deletes everything after the end of the tag. This is what the markup page looks like. I contacted support and they seemed to indicate that this was on purpose. Is there any way to make HTML run script included in-line without saying <script>? PS: I would be able to embed using iFrames, but for some reason the iFrames aren't working on the iPhone test program, even though they're working on the simulator.
What you can do is put it inside an HTML event attribute.
<body onload="/*your JS here*/">
</body>
If that does not work, try attaching onload to another HTML element or try one of the other event handlers (though I believe that they should have taken this into account as well)
How about this :
<body onload="javascript:(function(){
// you can place your code here it should run
alert('ok')
})()">
</body>
In Avatao's Senior Web Security Career Path, there is a hacking task, where you need to insert malicious javascript code - but the <script> is tag filtered (other tags aren't). Aenadon's answer gived me one solution:
<body onload="your JS here"> </body>
After submitting that, I checked the official solution, and I found that:
<img src="x" onerror=alert('xss')>
I'm using Firebug's Inspector to view source code. My code has been modified by JavaScript. I'd like to save the rendered code to a file, so that I can more easily compare it to the unmodified source. I'm having no luck with copy/paste. When I attempt to select the code, the contents of the inspector changes. I'm running OSX.
How can I save the rendered source code?
Hmmm.. Would expanding the HTML element in FB and then hitting CMD+A, CMD+C not help? What about using JS to copy the inner HTML of the top-most parent?
I'm using ExtJs 4.2.2 and included all necessary js and css files, and my codes work just fine, ONLY IF I write my code into script tags within my html file. When I try to put these code into another file with .js extension and include it between head tags properly, it returns nothing. I'm sure I've included my js file properly because when I fill it with standard js codes, I get results. But with ExtJS syntax, the same code which return results within script tags, returns nothing. How? Do I miss something?
The following two are equivalent. If one works, the others work, too, regardless of what js code you use:
(Ex 1.)
<html><head>
<script>//your js code here</script>
</head><body>
</body></html>
and
(Ex 2.)
<html><head>
<script src="jscode.js"></script>
</head><body>
</body></html>
where jscode.js contains
// your js code here
Furthermore, the following two are equivalent:
(Ex 3.)
<html><head>
</head><body>
<script>//your js code here</script>
</body></html>
and
(Ex 4.)
<html><head>
</head><body>
<script src="jscode.js"></script>
</body></html>
NOTHING will change in behaviour.
I think (but you didnt post ANY code at all, so it's jsut guessing) that you had Example 3 working, but changed to Example 2. But only 3 and 4 are equivalent! And now you call that ExtJS fault!
You are executing code in an onLoad event or a Load event, perhaps like:
$(window).load(function() {
$('p').css('');
})
Remove this section and use only this in the javascript file and include it in a <Head> section:
$('p').css('');
When you are coding in html, then it execute steps one by one. But when we use a separate file then it executes it slower than HTML code.
I think I can use those technique mentioned on the top.
I am sure it will work.
I'm using a MacBook Air and have been looking into ePub creation. I've taken a copy of the epub3 boilerplate from github click here. I have in a javascript file added the following
var txt = document.createTextNode(" This text was added to the DIV.");
document.getElementById('contenty').appendChild(txt);
<script src='../js/main.js'></script>
When I open the compiled epub in iBooks it doesn't show This text was added to the DIV. in the div #contenty.
Using Kitabu it actually works but is there a way to get Javascript to work in iBooks?
Thanks
Javascript will most definitely work in iBooks: just make sure to include your JS files in the opf manifest as items:
<item id="[someUniqueID]" href="[fileLocation/fileName.js]" media-type="text/javascript"/>
You also need to declare the page(s) that reference the script file as scripted in the OPF:
<item id="[pageID]" href="[pageLocaiton.xhtml]" media-type="application/xhtml+xml" properties="scripted" />
Note: you can get sideloading to work even without the above fixes, but you won't be able to actually put the book in the iBookstore without them.
Right now, your JS code won't work: because it is executing before the page loads: try doing a <body onload="init()"> and wrap your second line of code (document.getElementById....) in an function init(){}.
Best of luck any happy Scripting!
Basically, if I rightclick in any browser and choose to view source the code won't show up, even though i can clearly see the content on the page (tried on IE, Firefox, Chrome)
If I use the "inspect element" feature of Chrome/Firefox, I can however view the code
This is the respective code of my index.html:
<!-- [TABLE] -->
<div id="centercol" align="center">
<table id="table">
</table>
</div>
I'm using appendChild() to add the tr/td's in my javascript
InspectElement : http://i.imgur.com/pZBb5.png
View Source : http://i.imgur.com/W7pXm.png
Why does this happen?
Viewing source code sees the hard code / static code, inspecting DOM shows dynamic code as it's generated. You can get the generated source code using innerHTML.
The source code is the original document, unmodified by JavaScript
Inspect element shows you the serialization of the DOM, which is basically the markup that is visually represented on screen.
The "source code" is the original response body sent from server. When you inspect element, it represents the live state of the page in serialized form.
For instance, literally just sending this from server:
<script>
Might become this in inspector as the above is parsed and serialized:
<html><head><script></script></head><body></body></html>
It's happening because "viewsource" doesn't run JavaScript.
If your entire page is JS, then you'll just see the non-JS elements.