【发布时间】:2021-04-22 18:09:40
【问题描述】:
我正在使用 spring-boot WebSocket 和 SockJsClient 进行通知。 用户在 IE 中登录系统后,将显示以下弹出窗口,
以下是 UI (ReactJS) 代码:
<SockJsClient url={"URL"} topics={["topicname"]} onMessage={this.showNotificationCount} ref={(client) => { this.clientRef = client }} options={["xhr-polling"]} />)
后端代码(Java spring-boot):
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer
{
@Override
public void configureMessageBroker(MessageBrokerRegistry config)
{
config.enableSimpleBroker("/topic", "/user");
config.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry)
{
registry.addEndpoint("/notification-websocket").setAllowedOrigins("*").withSockJS().setWebSocketEnabled(false);
}
}
弹出文件内容:
我们可以禁用这个弹出窗口吗?
【问题讨论】:
-
IE 11的控制台有错误吗?您是否在其他浏览器的网络选项卡中查看过是否有这样的文件要下载?我在 github 中找到了a similar thread,您可以尝试 cmets 中的解决方案。该问题可能与 CORS 有关,您可以查看this source code 了解它是如何发生的。
-
感谢@YuZhou的回复,IE没有控制台错误,其他浏览器也没有下载此类文件。
标签: internet-explorer websocket spring-websocket sockjs