I have a WAB that when opened, shows a splash screen widget.
There is a custom action on popups of a feature layer that sends an email to someone using the custom url parameters. Don't want to have splash screen shown when the recipient clicks on the link.
Is there a way to close the splash widget when url parameters are detected?
Solved! Go to Solution.
Michael,
Sure it would just take some custom code. What parameter are you looking for in the url?
Here is an example (lines 17, 20, 24, 25, 37-39):
define(['dojo/_base/declare',
'dojo/_base/lang',
'dojo/_base/html',
'dojo/on',
'dojo/keys',
'dojo/query',
'dojo/cookie',
'dijit/_WidgetsInTemplateMixin',
'jimu/BaseWidget',
'dojo/topic',
'jimu/dijit/CheckBox',
'jimu/utils',
'esri/lang',
'jimu/dijit/LoadingShelter',
'dojo/Deferred',
'jimu/dijit/EditorXssFilter',
'esri/urlUtils'
],
function(declare, lang, html, on, keys, query, cookie, _WidgetsInTemplateMixin, BaseWidget, topic,
CheckBox, utils, esriLang, LoadingShelter, Deferred, EditorXssFilter, urlUtils) {
...
postCreate: function() {
...
this.urlObject = urlUtils.urlToObject(window.location.href);
this.urlObject.query = this.urlObject.query || {};
},
onOpen: function() {
if (!utils.isInConfigOrPreviewWindow()) {
var isFirstKey = this._getCookieKey();
var isfirst = cookie(isFirstKey);
if (esriLang.isDefined(isfirst) && isfirst.toString() === 'false') {
this.close();
}
}
if(esriLang.isDefined(this.urlObject.query.closeSplash) && this.urlObject.query.closeSplash == "true"){
this.close();
}
...
Michael,
Sure it would just take some custom code. What parameter are you looking for in the url?
Here is an example (lines 17, 20, 24, 25, 37-39):
define(['dojo/_base/declare',
'dojo/_base/lang',
'dojo/_base/html',
'dojo/on',
'dojo/keys',
'dojo/query',
'dojo/cookie',
'dijit/_WidgetsInTemplateMixin',
'jimu/BaseWidget',
'dojo/topic',
'jimu/dijit/CheckBox',
'jimu/utils',
'esri/lang',
'jimu/dijit/LoadingShelter',
'dojo/Deferred',
'jimu/dijit/EditorXssFilter',
'esri/urlUtils'
],
function(declare, lang, html, on, keys, query, cookie, _WidgetsInTemplateMixin, BaseWidget, topic,
CheckBox, utils, esriLang, LoadingShelter, Deferred, EditorXssFilter, urlUtils) {
...
postCreate: function() {
...
this.urlObject = urlUtils.urlToObject(window.location.href);
this.urlObject.query = this.urlObject.query || {};
},
onOpen: function() {
if (!utils.isInConfigOrPreviewWindow()) {
var isFirstKey = this._getCookieKey();
var isfirst = cookie(isFirstKey);
if (esriLang.isDefined(isfirst) && isfirst.toString() === 'false') {
this.close();
}
}
if(esriLang.isDefined(this.urlObject.query.closeSplash) && this.urlObject.query.closeSplash == "true"){
this.close();
}
...
I'm really just interested of the existence of a query parameter in the url.
So just change my code example above to line 36 to
if(esriLang.isDefined(this.urlObject.query.query)){
(yes two "query"s as the first query is just the object name that the browser gives to anything after the ? or & in the url).
So I ended up doing this:
?query=cipgis_144_373,CIPNumber,UTIL-UG-2019-17&closeSplash=true
Thank you!!!
I know it is much too late to ask for elucidations, but where exactly would this custom code go?
I'm in a similar spot: I'd like the WAB's Splash Widget to not deploy when URL Parameters are present. It would solve a major problem I've got at the moment. ...I just don't recognize your solution. But I'd like to!