How to show a browser alert window in Scala.js? JavaScript version is as follows:
alert()
alert(message)
Using scala-js-dom:
import org.scalajs.dom.window.alert
alert("Hello Scala.js")
Related
I am working on a plugin that launches a WebView to carry out some auth verification. Using the webview_flutter plugin, it works fine on Android and iOS once I call the runJavascriptReturningResult function. It returns the document.getElementById('return').innerText and then I parse the result. But on Flutter web, the webview_flutter_web does not currently support runJavascriptReturningResult, so it throws a platform error once invoked.
I tried using an HTML Popup, but I don't know how to extract the return data before the popup closes.
My implementation for the popup is like this:
html.WindowBase _popup = html.window.open(url, name,'left=100,top=100,width=800,height=600');
if (_popup.closed!) {
throw("Popups blocked");
}
How do I get the return data before the popup closes? Is there another way to do this on Flutter Web?
Maybe listening beforeunload event on the new window and getting the return value before it closes.
The solution was to listen to onMessage. Then get the event data from it.
html.window.open(url!, 'new tab');
html.window.onMessage.listen((event) async {
log(event.data.toString()); // Prints out the Message
});
i want to use waitForElementToBeRemoved method for react-testing library and it says cannot find name "waitForElementToBeRemoved".
Below is my code,
waitForElementToBeRemoved(getByTestId('test-id'));
After clicking a button i will have to wait for domchange so i tried
await waitForDomChange(getByTestid('test-id'));
this gave timeout error for domchange.
i think i will have to update react testing library. how can i update it???
thanks.
import { waitForElementToBeRemoved } from "#testing-library/react";
Is there a way to do a hard browser refresh when running an app with nwjs, on Mac? nwjs's right click 'simulate browser restart' seems to start the app at its entrypoint again. Is there a way to simulate the behavior of simply clicking the shift reload button in Chrome?
There is an nwjs api for this:
// Load native UI library
var ngui = require('nw.gui');
// Get the current window
var nwin = ngui.Window.get();
// this will do a hard refresh
nwin.reloadIgnoringCache();
// here's a regular refresh
nwin.reload();
nwjs doc:
http://docs.nwjs.io/en/latest/References/Window/#winreloadignoringcache
just use javascript reload
location.reload();
I'm developing a responsive website and i use the gumby framework http://gumbyframework.com/
Now, when i try to resize the window and the responsive menu appear, i click on the icon and it works. But if i try on a smartphone, nothing happen
this is the website i'm developing http://www.francescomigliorato.it/lachicca
Any help is much appreciated. Thanks in advance and sorry for my english
The solution is to use version 1.8.3 of jquery. With the latest there is a problem with gumbyframework
I notice in line 78 of main.js that you have a javascript error... I would fix that first and see what happens.
$('input.data').datepick({
Uncaught TypeError: Object [object Object] has no method 'datepick'
showTrigger: '#calImg'
});
In app mode, if I open a new window using javascript, the newly-opened window cannot close itself (on an on-click event) using the standard window.close() or self.close(). Does anyone know if there's an alternate method?
What I find most beguiling about this is that it goes against Apple's very own design guidelines: essentially a site has the ability to open a new window but the user cannot get out of it without closing the webapp using the Home button.
Any ideas? Thanks!
JavaScript:window.self.close() is how to do that.
you can try this js code snippet.
var win = window.open('','_self');
win.close();