B4J Question WebApp: help with WS.Eval("window.location ....

billyrudi

Active Member
Licensed User
Longtime User
Hi can anyone help me to understand why after a
WS.Eval("window.location = arguments[0]", Array As Object(Url))
the page is not redirect?
the server log reports
[28/Jan/2016:10:13:43 +0000] "GET //www.solargs.it/ws HTTP/1.1" 405 352 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"

or

[28/Jan/2016:11:09:42 +0000] "GET //www.solargs.it/b4j_ws.js HTTP/1.1" 304 0 "http://www.solargs.it/" "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
[28/Jan/2016:11:09:43 +0000] "GET //www.solargs.it/ws HTTP/1.1" 101 0 "-" "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"

tanks Paolo
 

Daestrum

Expert
Licensed User
Longtime User
I could be wrong, but shouldn't it be

window.location.href = .....
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
I think 304 has something to do with the cache of the browser. Have you tried using the AppVersion mechanism? This should force a reload of the pages. (it adds ?you_app_version to each .html, .css and .js, see the source code of ABMFeedback for an example. Make sure you also changed this code in ABMShared to use this mechanism).

B4X:
Public Sub NavigateToPage(ws As WebSocket, TargetUrl As String)   
    If AppVersion <> "" Then
        TargetUrl = TargetUrl & "?" & AppVersion
    End If
    If ws.Open Then
        ws.Eval("window.location = arguments[0]", Array As Object(TargetUrl))           
    End If
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…