Debugger displaying HTML instead of JavaScript - javascript

I am passing an html template of the previewer of Impressionist App for ownCloud, I am working on in js/templ.js and obviously impress.js will be called in the template via it. The src is correct, but then also my chrome debugger displays html as content in my impress.js file and console also gives javascript syntax error, due to the html being called. Why does it happen? Any clue?
The source code of my app can be found here.
Also, I am attaching an image of what I see in the debuggerhere

Related

javascript not working inside html div on slow internet

I am putting html content dynamically base on condition.
Inside html content i also have javascript in script tag.
My problem is on slow internet my javascript not load on page.
It's work fine on fast internet.
The same case faced.
Try with console.log() before and after your script.
You can see log print but not display here. Means this happens because of date picker js does not load properly or display any error so your script goes to stop.
Please load data picker js properly so resolve our issue.

Click button on webpage via Applescript - Error

I'm trying to click on a webpage item via AppleScript but with no success.
I tried the following code in chrome and safari:
execute "document.getElementById('t-strikethrough').click();"
and
do JavaScript "document.getElementById('t-strikethrough').click();"
In Safari, the first line of code does nothing and the result section of Script Editor says missing value. With Chrome, I get the following error:
Can’t make "document.getElementById('t-strikethrough').click();" into
type specifier
This is included inside tell statements to locate app, window and document.
Without seeing all of your AppleScript code, it's difficult to see exactly what the problem is. You may want to try setting a variable for the URL like this:
set URL of document 1 to "http://www.whatever.com"
do JavaScript "document.getElementById('t-strikethrough').click();" in document 1
Check this post to see the full example . Click Button on Webpage with Applescript/JavaScript

Loading external html using jquery.load() function gives unexpected results

I had a previous post related to this problem but I guess I was not clear enough or some other reason, I did not get a solution.
Old post here
I now have minimized the whole html to just demonstrate the problem and uploaded the html.
Here the link to the loaded HTML
There are two html files - main.html and sample.html. Main.html loads sample.html using jQuery.load(). There is a JavaScript inside the sample.html which query the width of a div and visibility of a div. Both queries gives wrong results. You can look at the debug console of the browser for the results returned. I have tried FF, IE and chrome and all gives the consistent wrong values. I guess I am not doing something correctly. What could be wrong here ?

Firebug: How to save rendered Source Code?

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?

GWT: Can I include js in html page or do I need `ScriptInjector`?

I am adding an html file to my GWT page like so:
HTML htmlPanel = new HTML();
String html = MyHtml.INSTANCE.getHtml().getText();
htmlPanel.setHTML(html);
RootPanel.get().add(htmlPanel);
and that works ... but the embedded script files don't run. I see the line in Chrome's Elements tab where the script should be loaded, but apparently it is not (doesn't show up in the Scripts tab, and debugger lines are not hit).
As a test, I loaded the html file straight into my browser (not via GWT), and the script does show up in the Scripts tab and it does run the code (so it's not an issue with the script tag itself).
So ... why/how do the scripts not run when embedded by GWT? (I wouldn't know how to keep an embedded script from running if I tried!) ;o)
Do I have to use the ScriptInjector to make this work (I'm having my own problems with getting that working, which is a subject for another thread)? If so ... why?
Thanks for your help!
Creating the script by adding it to an HTML widget and appending it to the page will not work, this is not supported by the browser. GWT isn't doing this, the browser is, or rather, the browser is doing it because of how the HTML widget works. For specifics on why this is the case, see the great answer at https://stackoverflow.com/a/13392818/860630 that digs into the details.
There are several other ways you can do this, but they all boil down to the work that the ScriptInjector is already doing - if ScriptInjector doesn't work for you, it seems unlikely that the other options will behave either. Maybe edit your question to use ScriptInjector and describe your issues, or ask a new question with it? The only cases where I've seen ScriptInjector not work is related to $wnd, or which page the script is appended to (see com.google.gwt.core.client.ScriptInjector#TOP_WINDOW).

Categories