Is There a way to Handle popups in nightmarejs - javascript

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.

Related

Browser Like Tabs for an iFrame web browser

I am developing a fun little project which is an iframe browser. The browser functions very well but the problem is, I can't seem to get tabs correctly. What I want for tabs is a remove and add function.
Will someone kindly help me out.
By the way my project can be found here: https://bird-pack.ml/lol/

Open multiple pages in once with javascript/ jquery

I want to create elements which (when clicked) will guide visitors towards two differenct websites (both in new windows). How can I do this? Below are the two ways which I tried, which both do not work as only one page/ window is opened. Thanks in advance!
Timo
The solution as suggested here: How to make a link open multiple pages when clicked . But maybe the solution is outdated, but for me only the first webpage is openend (with all the indicated solutions. (for example the code which is suggested there)
HTML Click Here
$('a.yourlink').click(function(e) {
e.preventDefault();
window.open('https://www.youtube.com/watch?v=H9XIXFwpyEc');
window.open('https://stackoverflow.com/search?q=open+multiple+pages');
});
While both using a class and an id with both a different a href and both with the extra options of opening new window also does not work as it only opens the first window
HTML Click Here
$('.yourlink').html(''); // Add page
$('.yourlink a').attr('target', '_blank');// Make sure it opens in new window
$('#extra').html(''); // Add page
$('#extra a').attr('target', '_blank');// Make sure it opens in new window
Using Chrome, I'm not seeing the problem you describe. But when I tested it in IE, I suddenly got a "popup blocked" message.
It's not strange though. I'd hate it if a single click on a link could suddenly spawn 10 new windows. In this scenario I actually think IE handles it better (by blocking the second window).
The thing is that window.open will only work if the action that invokes it is a trusted event. That usually means a user-initiated event, like click. But what Chrome doesn't account for (I assume) is that a single trusted event can then invoke several window.open.
I've tried to work around this feature, but have not (yet) been able to fool IE. The options, as I see it, are:
Ask users to add your site to the popup exceptions (internet settings).
Spawn the pages in iframes within your own site
Ask users to use another browser ;)
Or the obvious:
Use separate links for the windows

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

XUL and document.write()

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.

Javascript blur() command in IE8 on Vista doesnt work

I have a project that pops up a window with a message for the user. It is displayed for 10 seconds and then is sent to the background using the javascript self.blur() command. I dont want to close it as it has information that the user might need to see agian.
This currently works for IE7/IE8/FF2/FF3 on windows XP, but on Vista it does not work for IE8. I have found that if I disable 'Protected Mode' for IE8 on Vista, the blur() command works and the window correctly returns focus to the parent window.
Does anyone know exactly why this is happening and what can be done to get around it?
Any help would be greatly appreciated!
How are you writing to the window? What is the initial source of the window -- about:blank? This may make a difference. Also, if you're loading the web page from localhost, try running it from a "real" domain.
And a suggestion: try a lightbox or some other form of DHTML "layer". They've very easy to create with the various libraries available today; not only will this tactic get around the problem you're having, it improves the experience. Probably a bigger change than you'd really like, but oh so much better in the long run.

Categories

Resources