Thursday, 23 January 2020

hyperlink - MS Word validating links after click


Issue:


When clicking (or CTRL+clicking) a link in Microsoft Word 2010 (likely affecting other versions) that requires prior authorization, I'll frequently end up being pointed to an invalid URL. Theoretically, this is an issue with both Word and the service provider's own redirect, but I believe the issue is fundamentally with Word.


I've noticed that there is a delay of 1s-2s after clicking. It appears that Word is validating the link prior to opening my default browser. This is a problem because it also appears to be following the 301/302 redirect internally prior to opening the browser and instead opens the redirected URL instead of opening the browser using the originally specified URL.


Symptoms:



  • Lag when clicking (or CTRL+clicking) links in Microsoft word.

  • Website links which require authorization and redirect will result in opening default browser on the redirected page URL instead of the originally intended URL. If the site doesn't cleanly/transparently incorporate the return URL in the login page URL, it will effectively result in you not visiting to the intended page.

  • Servers which return a 500 or 403 error may be completely denied access, when all I want is for it to open in Chrome/Firefox/etc. This happens by presenting an error alert/dialog without ever leaving Word itself.


Example 1:


This particularly affects links which require authorization. For example, I found a URL on superuser.com that requires authorization and redirects if not authorized. The end result is you never get to the intended URL. While this is an error in superuser's redirect, the fundamental issue lives within Word.



  1. Link pasted into Word: https://superuser.com/users/preferences/

  2. In the background, processes this URL and, naturally because it or Internet Explorer is not logged in, it receives a response to visit: https://superuser.com/users/login?ssrc=user_prefs&returnurl=http%3a%2f%2fsuperuser.com%2fusers%2fpreferences%2f0

  3. Finally, since thankfully superuser.com knows I'm already logged in, it follows returnurl which unfortunately is still not valid: https://superuser.com/users/preferences/0


Example 2:


Another authorization example which demonstrates unclean redirect behavior is JIRA. This happens even if you're already authorized/logged in.



  1. Link pasted into word: https://INSTANCE.atlassian.net/browse/ISSUE-1234

  2. Word opens this URL: https://INSTANCE.atlassian.net/login?dest-url=%2Fbrowse%2ISSUE-1234&permission-violation=true

  3. Even though you're logged into JIRA, you will not be redirected to the originally intended URL so your journey ends here.


Conclusion:


How do I disable this or is it even possible to workaround at all?



Answer



It seems you're not using Internet Explorer as your default browser? Then you're probably running into "Microsoft Office Protocol Discovery". A few more details in my answer at Clicking hyperlinks in Email messages becomes painfully slow, here at Super User.


A registry workaround is described in You are redirected to a logon page or an error page, or you are prompted for authentication information when you click a hyperlink to a SSO Web site in an Office document:



Hyperlinks from Office to Internet Explorer or to another Web browser


If this issue occurs when you click hyperlinks in Office documents that either directly open HTML Web content or are redirected to HTML content, client users can avoid the problem by enabling a registry key to send the hyperlink navigation to the browser instead of directly binding to the hyperlink from Office. For more information, click the following article number to view the article in the Microsoft Knowledge Base:


218153 Error message: "Cannot locate the Internet server or proxy server" when clicking hyperlink


Note Regardless of the version of Office that you have installed, add the registry key in the exact location that is specified in Microsoft Knowledge Base article 218153.


When you use this registry setting, the HLINK component that is used by Office opens the hyperlink in the default Web browser. This registry setting affects all HLINK clients, not just Office. Therefore, use this registry key carefully. For more information about issues that may occur if you use this workaround, click the following article number to view the article in the Microsoft Knowledge Base:


280680 Cannot follow hyperlink to Office document



The above-mentioned KB218153 describes when this occurs:



The ForceShellExecute registry key is not present in the following location or is not set to 1:


For 32 bit Office Versions installed on 64 bit OperatingSystems


HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\9.0\Common\Internet


For 32 Bit Office Versions installed on 32 bit Operating Systems or 64 Bit Office Versions installed on 64 bit Operating Systems


HKEY_LOCAL_MACHINE \Software\Microsoft\Office\9.0\Common\Internet



So, adding ForceShellExecute with value 1 should stop this behaviour.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...