from chrome, i want to launch google in IE - javascript

I Want to: from chrome i want to launch google.com in IE.
Issue: when i run in chrome, google doesnt open. but if i am using IE, than google open up in IE
<Script>
function openURL(){
var shell = new ActiveXObject("WScript.Shell");
shell.run("iexplore http://google.com");
}
</Script>
<a onclick="openURL()" href=""> test </a>

The reason why this works in Internet Explorer (IE) and not Chrome is because ActiveXObject is not a web standard, and is only supported by IE. What you're asking for is unfortunately not possible at this time.

If this is just for you then you could create a custom protocol to open up internet explorer like you can do with the windows 10 calculator Calculator://
Then you would be able to launch it in plain html
Open Internet Explorer
Calculator example:
Open Calculator
https://support.shotgunsoftware.com/hc/en-us/articles/219031308-Launching-applications-using-custom-browser-protocols
You may also want to take a argument as a website to open somehow

Related

LOGOUT only works on Internet Explorer(11) when the Internet Explorer Developer Toolbar is visible

LOGOUT only works on Internet Explorer(11) when the Internet Explorer Developer Toolbar is visible
it working fine with chrome i tried all options from here but its not working
is anything wrong in code ?
I AM USING Ember
here is code
logoutPage(){
let parts = document.location.href.split('/');
let logOutUrl='/abc/unsecured/j_spring_logout'
window.location =logOutUrl;
}
am calling above function from
<a id="session_Logout" {{action "logoutPage"}} style="cursor: pointer;">{{toplevel.label}}</a>
Hi we also facing the same issue. When we check it with developer tool the IE version become 5 instead of IE 11 so we just added the
<meta http-equiv="X-UA-Compatible" content="IE=11" />
in the header section of sign out page. which force the page to use IE11 and its working fine.

Using window.print() or alternative on Android devices

On Android devices (I have tested Nexus 5, Nexus 10, Galaxy S4 and Galaxy Tab 3), the window.print() command in JavaScript doesn't do anything. As far as I can tell it doesn't even register an error.
I know for a fact that most if not all of these browsers can print because you can use mobile Chrome's menu to choose "print".
Why doesn't window.print() trigger the behavior you would expect (opening the clients print menu)? And is there an Android alternative to window.print()?
It is clearly stated in this Documentation, "The command is supported on iOS, Chrome on Windows and Safari and Chrome on Mac. It is not supported on Android."
Android phones don't have native support for printing yet, so window.print() will not work. Which means you need to use third-party app to do the printing. You could find some alternatives in this article.
I'm working on a simular problem and came up with this solution:
$(document).ready(function($) {
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
$('button.print').click(function(e) {
e.preventDefault();
if (isAndroid) {
// https://developers.google.com/cloud-print/docs/gadget
var gadget = new cloudprint.Gadget();
gadget.setPrintDocument("url", $('title').html(), window.location.href, "utf-8");
gadget.openPrintDialog();
} else {
window.print();
}
return false;
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button class="print">Print this page</button>
I haven't had the time to check if this works, i don't have an android device with me at the moment. I Would love to have some feedback on this ;-)
⚠️ [Deprecated] : Google Cloud Print will no longer be supported as of December 31, 2020. Please see the support article for help migrating.
Use Google Cloud Print (GCP) - there is no app required. The user must have set up a printer via GCP though.
This example uses GCP gadget
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Print</title>
</head>
<body>
<div>
<p>On android devices (I have tested Nexus 5, Nexus 10, Galaxy S4 and Galaxy Tab 3) the window.print() command in javascript doesn't do anything, as far as I can tell it doesn't even register an error.</p>
<p>I know for a fact that most if not all of these browsers can print because you can use mobile chromes menu to choose "print". My questions is, why doesn't window.print() trigger the behavior you would expect (opening the clients print menu).
And is there an android alternative to window.print()?</p>
</div>
<div id="gcpPrint"></div>
<script src="https://www.google.com/cloudprint/client/cpgadget.js">
</script>
<script>
var gadget = new cloudprint.Gadget();
gadget.setPrintButton(cloudprint.Gadget.createDefaultPrintButton("gcpPrint"));
gadget.setPrintDocument("text/html", "Print", document.documentElement.innerHTML);
</script>
</body>
</html>
I think, direct print() method is disabled on devices by default. I not saw so many phones or other Android devices with printer, however by USB it should be possible of course.
Instead, recommended is saving content/page as pdf and print it via some cloud print service.
At this moment, window.print() functionality works perfectly on my Android 5.0.1 device with both, Chrome and the default browser.
Now, window.print() is working on Android devices.
Download adobe acrobat in your phone and you can use windows.print() in mobile.

PDF embed not working in IE11, but it WORKS when edit the HTML in DOM Explorer (F12 - debug tool of IE)

Here is the Fiddle link "http://jsfiddle.net/Z99gr/2/" which similar to my code, I have created a Image slider using Galleriffic. In the image slider along with images I am showing PDF embedded.
The Fiddle link and my image slider works fine in Chrome and Firefox, but in IE I its not loading. I am testing in IE 11
In IE, when I open the "DOM Explorer (F12 - debug tool of IE)" and selects the <div> which contains the <embed> tag for PDF, it show below code.
<div id="pdf">
<embed width="500" height="375" src="https://www.adobe.com/products/pdfjobready/pdfs/pdftraag.pdf" type="application/pdf">
</embed>
</div>
And when I just edit anything in this HTML TAG within the "DOM Explorer (F12 - debug tool of IE)", it loads the PDF.
This is a very weird nature of this issue.
I don't understand how to fix this issue.
Please suggest!
I am getting below results inm IE11:
Where as the results should be something like this (its a screencapture from Chrome):
I was now able to embed the PDF file IE using "<iframe>" tag.
I replaced "<object>" and "<embed>" tag with <iframe> and its working fine now with all 3 browsers, Firefox, Chrome and IE.
There are 2 ways of embedding PDF in IE.
1st way: Call PDF directly in <iframe>
Below is the updated code:
<div id="pdf">
<iframe src="https://www.adobe.com/products/pdfjobready/pdfs/pdftraag.pdf" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
<p>It appears your web browser doesn't support iframes.</p>
</iframe>
</div>
2nd way: if the browser doesn't have PDF reader the u can call an HTML in page <iframe> which contains <object> tag .
Below is the code for 2nd option
<div id="pdf">
<iframe src="pdf.html" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
<p>It appears your web browser doesn't support iframes.</p>
</iframe>
</div>
Code for "pdf.html"
<body>
<object data="lorem.pdf" type="application/pdf">
<p>It appears you don't have Adobe Reader or PDF support in this web browser. Click here to download the PDF. Or click here to install Adobe Reader.</p>
<embed src="lorem.pdf" type="application/pdf" />
</object>
</body>
This worked for me!!!
Here is the WORKING Fiddle : http://jsfiddle.net/Z99gr/9/
Hope it will be helpful for others in future!
To anyone that has this issues in the future, you have to turn off compatibility mode for intranet sites.
Tools > Compatibility View Settings > Uncheck "Display Intranet sites in Compatibility View"
Developer tools overrides the compatibility view and displays the page in IE11. Compatibility makes the page display as IE5
Found a fix that worked for me...
I was using IE11, Win7 enterprise, and latest version of adobe reader XI which I had just updated.
The website I had a problem with, was using <object></object> to do the imbedded PDF (it was a CQ5 component, if that matters).
I didn't have to modify the html -- this is what i did:
1) Go to internet options in IE
2) Go to Advanced
3) Click "Reset...". I also clicked "delete personal settings" since I mainly use IE for testing web development so there's no much there...
4) Requires computer restart, so do that.
5) When you are back in, open IE11.
6) It will prompt you if you want to use it's default settings/accelerators. I said YES (i usually always said NO to this, in the past).
7) Open site, and enjoy success.
It also fixed this example site for me, so I know something good happened.
http://acroeng.adobe.com/Test_Files/browser_tests/embedded/embed2.html
I tried doing the "TabProcGrowth" fix in the registry (some other solution i found earlier), but that didn't work either. Only resetting IE to scratch worked for me.
Solution: Install adobe acrobat reader.
It appears to me that IE uses whatever reader is installed to view embedded or natively opened PDFs, whereas chrome, edge and other modern browsers comes with a PDF viewer of sorts.

javascript in meta tag not working on firefox and internet explorer

I noticed this:
<meta HTTP-EQUIV="REFRESH" CONTENT="0;URL=javascript:alert(2)">
Only works on chrome, so my question is, how can I execute JavaScript within a meta tag that will work on chrome, firefox and internet explorer?
As far as my tests have gone, that only works in chrome and not on internet explorer and firefox.
javascript: URIs where disabled in Firefox via MSFA 2009-22/CVE-2009-1312. I guess Internet Explorer disables such URIs for the same reason.
Hence you cannot use javascript: URIs for meta-refresh. Of course you're still free to do something like:
<script>
setTimeout(function() { alert(2); }, 0);
// or just
alert(2);
</script>

How to display a message when IE browser is opening?

I have a question and maybe it is duplicate in this site but i can't find it!
I want to display this message
"Please open this website in firefox and you can download Mozilla Firefox from here"
when users open my web in IE.
How do it?
Thanks in advance.
you can use a conditional check
<!--[if IE]>
please open this web in firefox and you can download Mozilla Firefox from <a href='here'>here</a>
<![endif]-->
or you could try adding a js/programming check
If you prefer Javascript, you can check the userAgent.
if (navigator.userAgent.indexOf('MSIE')>0) {
document.write('do something');
};
MSIE is the indicator for Microsoft Internet Explorer

Categories

Resources