Open caoliangnus opened 6 years ago
Nice đź‘Ť Confirmed works on all three OS: Windows, Linux, OS-X?
I am not sure about Linux system. For Windows, it has no such problem. For OS-X, I can confirm that it works.
I am not sure about Linux system. For Windows, it has no such problem. For OS-X, I can confirm that it works.
I meant, does it work on Windows after the fix? Fixing it for one platform can break it on another.
Yes, it works.
I realised that Google Map unable to load the page. Please see below for the solution.
Solution:
Change:
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko";
to:
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1";
Before:
After:
Thanks for the reuse offer. Works on Ubuntu 16.04 LTS
Thanks for the reuse offer. Works on Ubuntu 16.04 LTS
Nice.
@caoliangnus I encourage you to submit this fix as a PR to se-edu/addressbook-level4 , after the exams of course.
@Zhiyuan-Amos FYI
@damithc @Zhiyuan-Amos I'm assuming @caoliangnus used this source https://stackoverflow.com/questions/41952734/javafx-webview-font-issue-on-mac for the fix.
Note that it might be hacky and probably using the other method in the comments, i.e. engine.setUserAgent(engine.getUserAgent().replace("Macintosh‌​; ", ""));
might be better
As he said, setting the user agent to trick the system into thinking it is windows may not be such a good idea. Apparently Oracle knows about it and is a fix in Java 9: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8088205
However for the simplicity's sake, @caoliangnus's implementation should suffice
For Mac users, please refer to this PR
Before:
After: