I noticed that in SketchUp 2023, the User-Agent string no longer contains identifying information when making requests via the SketchUp WebDialog.
In previous SketchUp versions, the User-Agent clearly indicated that the request originated from a SketchUp WebDialog. However, this identity information is missing in SU2023.
My question is: does anyone know how to add custom headers to requests made by the WebDialog in SU2023? It would be helpful for our server-side code to distinguish if a request came from a SketchUp WebDialog.
I would appreciate any insights or suggestions on how to approach this in SU2023. Thank you all in advance for your comments!
PS: it is not an issue while using HTMLDialog, but in my case, i need to use Webdailog
Sorry, I assumed you meant that you were using script in the dialog to retrieve a URI. If you’re using dlg.set_url '<uri>' then opening the page, I don’t believe you can do anything with the request headers.
And, yes, you’re correct about User-Agent in SU2023. I tried SU2017, SU2020, and SU2022, and they all have ‘SketchUp’ in the User-Agent string.
Just to clarify for others, this question is about the HTTP request sent to the server. HTML is often returned in the HTTP response from the server, as it’s the format understood by browsers. Note that HTML is considered the content (or body) of the response. The response contains additional information (status, headers, etc) that one can see in ‘dev tools’. This information is not rendered by the browser.
… and above where I speak about <meta http-equiv ...> elements, they affect response headers, not request headers.
It is not clear to us whether the webpage displayed in the dialog is generated on the client-side or the server-side.
The “aim” of course is for the server to able to know, regardless of how the webpage is generated, whether or not the page is displayed within a SketchUp dialog window.
We also do not know what SketchUp versions are being targeted.
If the version is pre-2017, I would think the only solution is to use a specific URL (or subdomain or query parameters) for SketchUp dialogs. Any browser outside SketchUp would not (or should not) use this means of connecting to the server.