Forum Discussion
[Workaound] User required to manually start EPI and VPN in browsers
- Jan 30, 2024
2024-01-30: Updated to also include auto start of tunnels.
define(["require", "exports", "apmui"], function (require, exports, apmui_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var app = apmui_1.App.get();app.subscribe(apmui_1.EventType.EPS_CHECK_PROGRESS, function (_, store) {
var btns = document.getElementsByClassName("apmui-button");if (btns.length == 0) {
console.log("Failed to find button...");
return;
}btns[0].click();
});app.subscribe(apmui_1.EventType.DIALOG_OPEN, function (_, store) {
setTimeout(function () {
var dialog = document.getElementById("sna_auto_start_not_supported");if (dialog == null) {
try {
dialog = document.getElementsByClassName("restart_noautostart_action")[0];
} catch (e) { }
}
if (dialog == null) {
console.log("Didn't find the right dialog");
return;
}var btns = dialog.getElementsByClassName("apmui-button");
if (btns.length == 0) {
console.log("Didn't find the start button");
return;
}btns[0].click();
}, 100);
});
});
This is an updated version that will also auto start application tunnels:
<SPAN class="token function">define</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">[</SPAN><SPAN class="token string">"require"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"exports"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"apmui"</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token keyword">function</SPAN> <SPAN class="token punctuation">(</SPAN><SPAN class="token parameter">require<SPAN class="token punctuation">,</SPAN> exports<SPAN class="token punctuation">,</SPAN> apmui_1</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
<SPAN class="token string">"use strict"</SPAN><SPAN class="token punctuation">;</SPAN>
Object<SPAN class="token punctuation">.</SPAN><SPAN class="token function">defineProperty</SPAN><SPAN class="token punctuation">(</SPAN>exports<SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"__esModule"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">{</SPAN> <SPAN class="token literal-property property">value</SPAN><SPAN class="token operator">:</SPAN> <SPAN class="token boolean">true</SPAN> <SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">var</SPAN> app <SPAN class="token operator">=</SPAN> apmui_1<SPAN class="token punctuation">.</SPAN>App<SPAN class="token punctuation">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
app<SPAN class="token punctuation">.</SPAN><SPAN class="token function">subscribe</SPAN><SPAN class="token punctuation">(</SPAN>apmui_1<SPAN class="token punctuation">.</SPAN>EventType<SPAN class="token punctuation">.</SPAN><SPAN class="token constant">EPS_CHECK_PROGRESS</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token keyword">function</SPAN> <SPAN class="token punctuation">(</SPAN><SPAN class="token parameter">_<SPAN class="token punctuation">,</SPAN> store</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
<SPAN class="token keyword">var</SPAN> btns <SPAN class="token operator">=</SPAN> document<SPAN class="token punctuation">.</SPAN><SPAN class="token function">getElementsByClassName</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"apmui-button"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">if</SPAN> <SPAN class="token punctuation">(</SPAN>btns<SPAN class="token punctuation">.</SPAN>length <SPAN class="token operator">==</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
console<SPAN class="token punctuation">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"Failed to find button..."</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">return</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN>
btns<SPAN class="token punctuation">[</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">.</SPAN><SPAN class="token function">click</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
app<SPAN class="token punctuation">.</SPAN><SPAN class="token function">subscribe</SPAN><SPAN class="token punctuation">(</SPAN>apmui_1<SPAN class="token punctuation">.</SPAN>EventType<SPAN class="token punctuation">.</SPAN><SPAN class="token constant">DIALOG_OPEN</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token keyword">function</SPAN> <SPAN class="token punctuation">(</SPAN><SPAN class="token parameter">_<SPAN class="token punctuation">,</SPAN> store</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
<SPAN class="token function">setTimeout</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token keyword">function</SPAN> <SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
<SPAN class="token keyword">var</SPAN> dialog <SPAN class="token operator">=</SPAN> document<SPAN class="token punctuation">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"sna_auto_start_not_supported"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">if</SPAN> <SPAN class="token punctuation">(</SPAN>dialog <SPAN class="token operator">==</SPAN> <SPAN class="token keyword">null</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
<SPAN class="token keyword">try</SPAN> <SPAN class="token punctuation">{</SPAN>
dialog <SPAN class="token operator">=</SPAN> document<SPAN class="token punctuation">.</SPAN><SPAN class="token function">getElementsByClassName</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"restart_noautostart_action"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">[</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN> <SPAN class="token keyword">catch</SPAN> <SPAN class="token punctuation">(</SPAN>e<SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN> <SPAN class="token punctuation">}</SPAN>
<SPAN class="token punctuation">}</SPAN>
<SPAN class="token keyword">if</SPAN> <SPAN class="token punctuation">(</SPAN>dialog <SPAN class="token operator">==</SPAN> <SPAN class="token keyword">null</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
console<SPAN class="token punctuation">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"Didn't find the right dialog"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">return</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN>
<SPAN class="token keyword">var</SPAN> btns <SPAN class="token operator">=</SPAN> dialog<SPAN class="token punctuation">.</SPAN><SPAN class="token function">getElementsByClassName</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"apmui-button"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">if</SPAN> <SPAN class="token punctuation">(</SPAN>btns<SPAN class="token punctuation">.</SPAN>length <SPAN class="token operator">==</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN>
console<SPAN class="token punctuation">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"Didn't find the start button"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token keyword">return</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN>
btns<SPAN class="token punctuation">[</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">.</SPAN><SPAN class="token function">click</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">100</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com