when requesting http in arduino javascript document ready - javascript

I am requesting a web page with wifi using ESP 8266.
When this page is loading will the javascript on this page be activated?
Should I expect the 'document.ready' to be fired?
Thanks in advance for any info and/or supporting push to get my quest for an answer in the right direction.

I am requesting a web page with wifi using ESP 8266
The hardware you use is more-or-less irrelevant.
When this page is loading will the javascript on this page be activated?
That depends on the software you are making the request with. It would have to be something that ran JavaScript for the JS to run.
(e.g. if you were using Google Chrome, then the JS probably would run but if you were just using cURL then it would not).
Speculation: You are making the HTTP request with a C++ HTTP library and not a web browser. You won't have any JS support.

Related

Writing a Chrome extension to block websites

I am trying to implement a Chrome Browser Extension.
The Extension should take the web content (HTML + Javascript Code) of any user-requested Website
and should firstly block that content from displaying. Also, no Javascript Code should be executed at this point.
The Extension should then send the entire web content to my Python Flask Web Application and wait for a response. Based on the Response of my Web Application, the Web Content should either be allowed and normally displayed and executed or be disallowed while loading a premade disallow.html file.
I know how to implement the Python Web Application, and no further discussion of the logic inside that application is needed for answering this question. The part which I'm not sure about yet is blocking content and allowing or disallowing it based on the decision of my application.
Any help would be highly appreciated

How to twitter like load a webpage

I'm the only one that noticed that the new version of twitter desktop even if there is no internet it still loads the main styling and then just tell that there is no internet? Well I did and now I'd like to make to a website that can be loaded even without internet, can anyone tell me how? I'm using pure HTML, CSS and js as front end and node js as a back end.
I currently have no idea how to do it
I'd like it to load ad be able to run flew scripts to generate elements on the page.
It's called Progressive Web Apps, Progressive Web Apps (PWAs) are web applications that are regular web pages or websites, but can appear to the user like traditional applications or native mobile applications. The application type attempts to combine features offered by most modern browsers with the benefits of a mobile experience.
https://developers.google.com/web/progressive-web-apps
https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp
A Web cache (or HTTP cache) is an information technology for the temporary storage (caching) of Web documents, such as Web pages, images, and other types of Web multimedia, to reduce server lag. --Wikipedia.
The web page is already stored, when you load it loads from the cache and a function which checks for connection gives the alert of no internet connection.

How to handle JavaScript files via Jmeter

I get this message in Jmeter when I run my testplan.
<noscript>
<p>
<strong>Note:</strong> Since your browser does not support JavaScript,
you must press the Continue button once to proceed.
</p>
</noscript>
How do I get around this issue on JMeter? When I go to the link manually in Chrome, the page/charts load fine.
I asked the UI engineer how things worked and they said when we go to the webpage
The http request returns an html
The browser reads the html and requests js files.
Thanks in advance for any help.
As per JMeter Project main page:
JMeter is not a browser
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
Browsers don't do any magic, they just execute HTTP requests and render responses. If JavaScript is being used to "draw" something on page - you should not be interested in it as it happens solely on client side.
If JavaScript is used for building i.e. AJAX requests - these are basically "normal" HTTP Requests which can be recorded using HTTP(S) Test Script Recorder and replayed via HTTP Request samplers.
If you cannot successfully replay your script - most likely you're missing HTTP Cookie Manager and/or need to perform correlation of dynamic parameter(s)

Javascript access desktop application

I'd like you to give a tip for my issue. I'm pretty new to javascript so I don't have such overview.
I have a desktop application - it's basically a storega for data (+ some GUI). And there's a set of Javascript files, which are ment to get data from desktop application.
These javascript files runs in every browser - for each browser I've made a extension wrapper. There is also a testing java-webkit browser, which injects these files directly (so no extension's API).
So I need to create communication API between Javascript and desktop application, which is able to run in every environment (browser-specific implementation would be too "expensive" to maintain).
So I was thinking of sockets. But there is only Websocket protocol support in javascript. Client looks simple, but I'm afraid that server-side would require too much work and dependecies.
Could you give me a tip, for other technologies, which compatible with my requirments?
And second question - to the sockets - would it be even possible to access socket on "localhost:port" from these's javascript files, when they are Content scripts running in page's context?
Thank you for advice.
Sockets is the way to do it. #Luckyrat has provided some code on how to do it from a Firefox Addon:
https://stackoverflow.com/a/17459064/3791822

Programmatically call a firefox extension from javascript

I have seen this excellent firefox extension, Screengrab!. It takes a "picture" of the web page and copies it to the clipboard or saves it to a png file. I need to do so, but with a new web page, from an url I have in javascript. I can open the web page in a new window, but then I have to call the extension -not to press the control- and saves the page once the page is fully loaded.
Is it possible?
I am pretty certain that it is not possible to access any Firefox add-on through web page content. This could create privacy and/or security issues within the Firefox browser (as the user has never given you permission to access such content on their machine). For this reason, I believe Firefox add-ons run in an entirely different JavaScript context, thereby making this entirely impossible.
However, as Dmitriy's answer states, there are server-side workarounds that can be performed.
Does not look like ScreenGrab has any javascript API.
There is a PHP solution for Saving Web Page as Image.
If you need to do it from JavaScript (from client side) - you can:
Step 1: Create a PHP server app that does the trick (see the link), and that accepts JSONP call.
Step 2: Create a client side page (JavaScript) that will send a JSONP request to that PHP script. See my answer here, that will help you to create such request.

Categories

Resources