How to include External Script using console? [duplicate] - javascript

This question already has answers here:
javascript - how to insert a script tag to div?
(4 answers)
Closed 5 years ago.
I want to know ,
How to include External JavaScript into current page using developer console.
I am having static plain html/js i want to test it with several js libraries as well as css in it. without adding in .html file or i am from remote machine.
so how do achieve it using Developer console?

You can try this to inject your script into HTML DOM
inject = document.createElement('script');
inject.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(inject);

Related

I want to Integrate a button onto my website such that it deletes and creates new cookies for a specific website [duplicate]

This question already has an answer here:
How to make a HTML script that replaces the cookies of a website
(1 answer)
Closed 1 year ago.
I've been trying to make a html script along with js such that it modifies the cookies of a specific website, Can anyone help me with this?
If this is a extension you could use https://developer.chrome.com/docs/extensions/reference/cookies/ to get the other websites cookies and deleting them, using chrome.cookies.getAll and chrome.cookies.remove

Use Javascript to run Bash script in background [duplicate]

This question already has answers here:
How to execute shell command in Javascript
(16 answers)
Closed 5 years ago.
I currently have a project site ( interact.rdarellano.com ) which uses PHP forms to run Bash scripts on my webserver. I'm not happy with this PHP method because it reloads the site every time that the button is clicked.
I've read that Javascript may be able to handle this task in the background. I've never experimented with Javascript so I'm hoping to find somebody that can help me achieve this or guide me on how to set this up.
Read about JSON and AJAX. Start with Jquery which has methods to deal with this.

Can Nokogiri render Javascript? [duplicate]

This question already has answers here:
Can Nokogiri interpret javascript? - Web Scraping
(2 answers)
Closed 7 years ago.
I am curious if Nokogiri can see JavaScript. If not, what is the best way to get around it without anything like Watir or PanthomJS?
For example, the photos on this page are controlled by JavaScript: http://twotreesny.com/residential/rentals/110livingston
They are not shown when I disabled Javascript. In this case, what is the best way to grab these images?
Nokogiri is actually just a parser for HTML. You need a browser engine, like Selenium, or WebKit, which will load the page like your browser does, and run the JavaScript scripts.
The easiest way for you would be to build some crawler with Capybara + Phantomjs.

How to open a word document in a new tab/window without downloading the file using HTML/JavaScript? [duplicate]

This question already has answers here:
word document viewer browser plugin
(3 answers)
Closed 9 years ago.
I dont want to download the word document instead I just wish to view the file in the browser itself.
How is this possible with HTML and JavaScript ?
Most of the main browsers have plugins that you can install that allow you to view word documents. This is one for Chrome:
https://chrome.google.com/webstore/detail/docs-pdfpowerpointviewer/nnbmlagghjjcbdhgmkedmbmedengocbn?hl=en
It is under Office Apps.
Here is one for firefox:
https://addons.mozilla.org/en-US/firefox/addon/google-docs-viewer-pdf-doc-doc/
This is the reason why you use PDF documents.
Go to your word document and save it as a pdf. You can do it via the ribbons.

How to read and debug the compressed javascript file? [duplicate]

This question already has answers here:
How do you debug through a compressed JavaScript file? [duplicate]
(4 answers)
Closed 7 years ago.
I saw an interesting js file in a website, but i cannot read it because it is minimized.
Is there any service or method to convert it to a readable file?
The minimized js file is similar to the compiled output from Google Closure Compiler.
You can use http://jsbeautifier.org
There is also a similar feature provided by UglifyJs which has an option for beautifying the code:

Categories