Hello community,
I tried a little bit more and find out that the manually adding of
Code: Select all
<script type="text/javascript" src="mobile-detect.js"></script>
in the SpiderBasic_Compilation0.html works fine. On this case I can use the library without any errors. So I changed the program to add this code automatically, but I doesn't work also.
Code: Select all
; Begin-----------------------------------------------------------------
; Sub LoadScript------------------------------------------------------
Procedure LoadScript(script.s, *func)
!$.getScript(v_script, p_func);
EndProcedure
; Sub Main------------------------------------------------------------
Procedure Main()
!var v_script = document.createElement("script");
!v_script.setAttribute("type", "text/javascript");
!v_script.setAttribute("src", "mobile-detect.js");
!document.getElementsByTagName('head')[0].appendChild(v_script);
!var md = new MobileDetect(window.navigator.userAgent);
EndProcedure
; Main----------------------------------------------------------------
LoadScript("mobile-detect.js", @Main())
; End-------------------------------------------------------------------
Code: Select all
; Begin-----------------------------------------------------------------
; Sub LoadScript------------------------------------------------------
Procedure LoadScript(script.s, *func)
!$.getScript(v_script, p_func);
EndProcedure
; Sub Main------------------------------------------------------------
Procedure Main()
; Variables-------------------------------------------------------
Protected md.i
!v_md = new MobileDetect(window.navigator.userAgent);
EndProcedure
; Main----------------------------------------------------------------
!var v_script = document.createElement("script");
!v_script.setAttribute("type", "text/javascript");
!v_script.setAttribute("src", "mobile-detect.js");
!var v_head = document.getElementsByTagName("head")[0]
!v_head.insertBefore(v_script, v_head.firstChild);
;!v_head.appendChild(v_script);
LoadScript("mobile-detect.js", @Main())
; End-------------------------------------------------------------------
What is the correct way to add a JavaScript library in SpiderBasic equivalent to the script tag in the html header?
Thanks for tips and hints.
Cheers
Stefan