Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Edge browser LocationListener links are blocked(Edge browser LocationListener links are blocked)
Edge browser LocationListener links are blocked [message #1854983] Wed, 21 September 2022 22:05 Go to next message
Martin J is currently offline Martin JFriend
Messages: 50
Registered: August 2015
Member
Edge browser LocationListener link is blocked.
When link is clicked, Edge browser LocationListener is providing the following location information;
      about:blank#blocked

It is supposed to be;
       about:aaa.html

So Edge browser must be blocking URL links. Is there anyway I can unblock this?

The following is the whole code;
package rosella.test;

import org.eclipse.swt.*;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.widgets.*;

import org.eclipse.swt.layout.*;

public class GuiTest1 implements LocationListener {

	public static void main (String [] args) {
		GuiTest1 gt = new GuiTest1();
		gt.execute();
	}
	
	Display display;
	Shell shell;
	Browser browser;
	
	GuiTest1() {
		display = new Display ();
		shell = new Shell(display);
		shell.setText("Snippet 1");
		shell.setLayout (new FillLayout ());
		browser = new Browser(shell, SWT.EDGE);
		browser.addLocationListener(this);
		browser.setText("<html><body><a href=\"aaa.html\">LINK</a> </body></html>");
	}
	
	void execute() {
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) display.sleep();
		}
		display.dispose();
	}

	@Override
	public void changed(LocationEvent evt) {
		System.out.println("Changed: "+evt);
	}

	@Override
	public void changing(LocationEvent evt) {
		System.out.println("Changing: "+evt);
		System.out.println("Location: "+evt.location);
		String location = evt.location;
		if (location.startsWith("data") || 
				location.startsWith("about:blank") ) {
			evt.doit = true;
		} else {
			browser.setText("<html><body> BBBBBB </body></html>");
			evt.doit = false;
		}
	}
}
Re: Edge browser LocationListener links are blocked [message #1854986 is a reply to message #1854983] Thu, 22 September 2022 06:48 Go to previous message
Martin J is currently offline Martin JFriend
Messages: 50
Registered: August 2015
Member
It appears that Microsoft is blocking links if it is not known. But file based url seems working. It delivers correct url without blocking. So I have to install help pages as files. Then hyper links work. Which means that when start of swt program, I have to check jar file last modified date and, if old, inflate help pages as files.
Previous Topic:KeyEvents are not triggered for Browser SWT.EDGE
Next Topic:(Windows) Bad List update on swt version 3.120.0
Goto Forum:
  


Current Time: Mon May 06 13:17:11 GMT 2024

Powered by FUDForum. Page generated in 0.02938 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top