XUL and document.write() - javascript

I'm attempting to create a simple firefox extension and am stumbling on what I'm allowed to do in a XUL window.
I'd like to use document.write or get a handle on a textarea to collect data and display it when a button is clicked.
Are there any tutorials on how to do this? From what I've been reading, people have suggested opening a new window and writing to it, but my goal is a persistent window at the bottom of the browser.

I wrote a simple XUL application using xulrunner. Try this : http://plindenbaum.blogspot.com/2009/02/standalone-xul-application-translating.html
Later when your application will be correctly running you will transform it into an extension.
Hope it helps.

Related

Click using Javascript in Chrome

I am trying to click on page two using JS
https://www.abbreviations.com/sr
So I opened the console and put
document.getElementsByClassName('rc5')[1].click();
But it didn't click it and go to that page
This worked for me:
document.querySelectorAll(".pager > .rc5")[1].click()
what kind action you want to get as your 'click' result? first, it may be important to determine, that browser defines clicks as 'native' and 'generated by the code' and in the case of security and browsers policies.
but there is one smart method to work with DOM - headless browsers, like puppeteer.
you can do really anything with the webpage, using pure javascript.

Is There a way to Handle popups in nightmarejs

I need to handle site's popups window in nightmarejs. I mean things like windows open list, close, scrape those created popups and maybe suscribe to popup creation event
Thank you
I got the same problem in the 2 mouth ago.
I think the nightmarejs cant do the popups.
I used the spookyjs to slove this problem.
Depends on what kind of popups you're talking about. For external windows, we're currently out of luck until Electron #2605 is fixed. For HTML flyovers, Nightmare should work fine. For native popups - confirm, alert, etc - you'll need to take a look at defining your own preload.

Force console to be open on load within iframe - chrome

I am trying to create some simple tutorials, which involve people using the console in chrome. Ideally I would like to build them in a codecademy style - so instead of saying 'browse to this element in the console' and the user having to go to a separate demo page and do this, it would be built into one page.
So, I would have the tutorial, and then an iframe containing the demo page. I need the console to be open in the iframe page (and stay contained within it), but still be usable.
I know in chrome you can change which iframe you are viewing in the dev tools, and if needs be I will simply instruct users to do that, but I feel it would be more effective / smoother if the console was actually within the iframe and was automatically there.
Is there any way to do this?
Thanks in advance.

JavaScript alert with image and link

I was navigating on this page and clicked "Available for your computer" image.
Then a native browser popup that is like an alert was opened:
Please compare the one above with the following alert() that everybody knows:
How did they create such an alert?
alert seems not to support images, according to this question.
Is this possible to open with JavaScript? I guess yes, but how?
Is this cross-browser? On Firefox, I am redirected to Chrome download page.
NOTE: I DO know that there are a lot of JavaScript libraries to show alerts, but I DO NOT want to use any of them. I want a clear answer to my question.
Chrome has some specialized windows/popups available for it's own use .. things you can't do via regular JavaScript.
Other things you can't do via regular JavaScript are the
Enable Webcam prompt window
Download file window.
If you are trying to do something similar in pure JavaScript, this is a great little replacement:
http://www.codersgrid.com/2013/07/05/alertify-js-replacement-of-your-browser-alert-dialog/
This seems to be a "chrome specific" popup. The application you want to install by clicking on this button is a Google App, which install is handled by Chrome. I think.
Except Bootstrap-like modals, I have never seen such thing in Javascript before.
Check this if you want to implement such popups on your website:
http://getbootstrap.com/javascript/#modals
instead of using alert . you can use any external plugin confirm box.Then you can customize your dialog box

How do I access my Firefox addon toolbar button from the js code?

I am new to Firefox addon development and just figured out how to add a XUL toolbarbutton to the browser's toolbar.
I'm not sure, however, how to get a handle to that button from my js code.
I need to swap the image on the button when certain content is found within a web page.
Just to be clear, my issue is not locating the page content, but making my toolbarbutton "react" to it.
Thanks!
Having a similar issue, I managed to get a mouseover event attached to a button. See my thread here.
It's a bit complicated. You have to add addEventListener to the xul node.

Categories

Resources