I encountered a very weird issue when trying to create a Dynamic Navigation Menu on APEX 5.0.4. I needed to be able to generate whether a URL could be specified to open within an iFrame on the homepage of the application, or to open up as if target=_blank had been enabled. Using a case statement it wasn’t too difficult to find out how to dynamically generate the link that did this. The “New Tab” link generated looks like this:
Except Internet Explorer 11 had some different ideas.
On any modern browser whenever I generated and clicked on the “Open in New Tab” link, a new tab would open and both would work perfectly fine. On IE11 though, it would open the new tab which would function correctly but the parent page would break, showing only one thing: [object].
Thanks to some lucky Googling I was able to find an answer, and Maxime Tremblay also kindly added an explanation on why this issue occurs.
;void(0); to the end of the “New Tab” code it works, so now it looks like this:
This is what Maxime had to say about the issue:
We also stumbled on that some time ago for a dynamic navigation menu just like you did.
The cause is that the openInNewWindow JS function is returning an object
Returns the window object of the named window or null if for some reason the window isn’t opened.
and IE being IE is trying to display that object…
As you said appending void prevents the returning object.
What we ended up doing is this:
The two works just as fine. Just be sure to comment that the void has a use because another dev could see this as useless code and could remove it.
So hopefully if you encounter this problem you’ll either find this blog post or my post on the Oracle APEX forums because it plagued me for far too long and I got very lucky to find the solution.