Source Code Appears to Be Hidden - javascript

I'm trying to debug a particular website (that I do not control, but I'm helping to debug) and I did find the problem, but ran into something I've not seen before and hoping someone can explain it. When viewing the source code of the page using Chrome's Javascript Console I see more code than when viewing the source with the built in browser "View Source" function.
I've searched around and think this may have something to do with "Javascript Encryption", but I'm not sure.
I really appreciate the help!

You cannot "view source" with Chrome's JavaScript console. You can only view the current state of the DOM. Any elements added by JavaScript will appear there, but not in the "view source" of page, hence the difference you're seeing.
Completely, totally unrelated to "Javascript Encryption".

It looks like they're built in https://www.legalshield.com/assets/js/video-library.js . Specifically, var thumbnail_hostname = 'http://www.legalshield.com'; near the top of that script would need to be changed.

Related

Personal toolbar button in Forge Viewer not appearing

I followed the tutorial to learn Autodesk Forge. I linked my BIM 360 account to the Forge Viewer. I would now like to add extensions to it and have a button on the toolbar that links to my extensions.
However when I follow the extension tutorial, nothing shows up. I also tried this one https://forge.autodesk.com/en/docs/viewer/v5/tutorials/toolbar-button/#before-you-begin and nothing appear.
I do not know what I am doing wrong since it seems to work if we follow the tutorial...
I am working on VS code
Right now, my code looks like this in the index.html file :
enter image description here
The rest is exactly like the tutorial except that I replaced "MyAwesomeExtension" with "PieChartExtension"
One thing to try will be to switch your var config3d to the following:
var config3d = {extensions: ['PieChartExtension']}
The reason might be, your syntax might be affecting and that is why the Viewer does not understand what to load. Did you check the console for any messaging?

Javascript and Chrome's New Tab (and alternate solutions)

I'm looking to either run javascript in a new tab of Chrome, or some alternative. The issue here is that it won't run, and I'm stuck, even after doing a bit of looking.
I've searched on here, and there was only one response saying it's not possible, however I don't fully understand this. After looking, I haven't found much more information on this matter.
As for any specifics - I want to toy around making a new tab extension for chrome, perhaps something fully fledged soon. Part of it includes a clock and some other things (at least for now), and I've got a clock working on the normal page if I view it normally, but this is where things get annoying. Load the extension into chrome, and.... nothing. Point is, I want to make a new tab replacement for chrome that uses JavaScript, and currently I cannot get it to run any javascript, even something simple as a clock script.
Now the initial information I found says that javascript does not work, but here's some things that would appear to contradict this:
https://developer.chrome.com/extensions/override states:
"...In addition to HTML, an override page usually has CSS and JavaScript code."
Nowhere further down do I see it making any kind of 'exception' for new tab pages where you cannot use JavaScript.
Additionally, consider the new tab page called Cardboard - it's a really pretty Google Now styled new tab page.... yet it isn't incredibly static. In fact, it has scripts, when I inspect the page! Specifically, things like google-analytics-bundle.js, dependencies.min.js and cardboard.min.js (which other than the first two, this certainly looks like a script intended for the plugin, and not from google specifically so I would assume this isn't google-approved only code or something like that).
At this point, I'm stumped. How would I be able to get javascript running on my new tab page? Is there a difference in functionality between an unpacked and packed extension that I don't see any information about? If this isn't possible, is there any other option I can have to substitute this?

Javascript code is showed in single line in ie10 developer tool

Having problem with debugging javascript code in IE10. When page loads, my scripts are shown in single line, which makes step-by-step debugging impossible.
Is there any way to get my code displayed the way I wrote it?
It looks like you may have resolved this issue yourself. However, in the future if you ever want to "pretty print" minified single-lined javascript code, click the Configuration button (looks like a hammer+wrench), and then click "Format JavaScript"
You can learn more here: http://msdn.microsoft.com/en-us/library/ie/gg699336(v=vs.85).aspx#prettyprintscript

Using Chrome Dev Tools to find out what's causing FOUC

I have been fixing up a sites JS, moving it to the bottom, minifying, etc. And it's all gone okay except on the blog (of an e-commerce site), as the page loads it's causing the header to be un-styled for a second or so, but it isn't happening on any other part of the site, even though they share the same CSS/JS. The blog is image heavy, but with images disabled (and I've tried disabling scripts too), it still happens. It's only happened since I've made changes, which I can't revert simply, but the changes are all positive and should help if anything. I can't see any JS causing it (as I removed the scripts to see if it was in there) and it doesn't happen in FF.
I would share a link but it's behind a closed staging server. And I could provide code but I'm not sure what, and there's a lot.
So, I had hoped I could use Dev tools to figure out what's happening, possibly the timeline view or something. I just don't know how I'd go about doing that.
Any advice?
Ed: I used the network tab on both the staging and the live site, as you can see from the image, they're identical, the css is the first thing loaded after the actual page, and on the live site it's actually ga.js. So it's even more of a puzzle now...
Don't worry, figured it out... It was the Stylebot Chrome Extension.. No idea why it was causing it now after making those changes though, and why it didn't affect the live site. I had no styles defined in it for this domain. A bug I guess.
Cheers all the same :)
Timeline tab in the dev tools is for benchmarking / site performance testing. If you want to know what's happening as in what content is being loaded, when and where, you can use the network tab for that.
It's also a common practice to stuff console.log() everywhere with some relevant message so you know when some part of code is being run.

Edit opened HTML Page, with Javascript

I was looking into making Firefox addons, and I need some help.
Is it possible to edit an HTML page that is open in the browser with javascript?
For example:
User types in "google.com"
Addon is activated
Javascript changes contents of "google.com" to maybe say "Hello!" at the bottom.
Of course this isn't specifically what I want to do, but a push in the right direction on how to accomplish such a task would be great.
~Carpetfizz
From within a Firefox addon this is obviously possible as many extensions do this.
If you, however, simply want to modify the DOM and nothing else than I would recommend taking a look at greasemonkey. Loads of example scripts around to do this: http://userscripts.org/
And the added benefit, if written correctly they also work in Chrome and other browsers.
Yes, it is. You must find a tutorial about javascript DOM manipulation

Categories

Resources