How to enable Javascript - webbrowser for windows phone 7.1 - windows-phone-7.1

I am creating a windows 7.1 phone app where I am using webbrowser to display some web content.
I want to know how to enable JavaScript in the browser object in my app?
I have set the IsScriptEnabled property to true but that does not seem to help.
Any ideas? Thanks in advance.

Following the MSDN WebBrowser.IsScriptEnabled help you have to refresh WebBrowser content after enabling scripts to make it really happen:
WebBrowser.IsScriptEnabled Property
Enables or disables scripting.
This applies to the next document that is navigated to, not the
current document. This property is false by default. Set this property
to true to enable scripting, or false to disable scripting.

It's more than enabling the scripts in the webbrowser, you also need to add a ScriptNotify handler.
<phone:WebBrowser Name="browser"
IsScriptEnabled="True"
ScriptNotify="browser_ScriptNotify"
Source="HTML/Default.html"/>

Related

IE11 prevents ActiveX from running

Our web browser plugin works fine in IE9 and IE10 but in IE11 the plugin is neither recognized as an add-on or allowed to run. It's as if IE11 no longer supports ActiveX.
Surely there is a workaround but what do we need to change?
NOTE: this questions is asked as the developer of the plugin and not the end-user who might need to correct IE settings!
IE displays a active x warning and ask for permission if you allow it to run or not. To overcome this the only solution is to;
Open Internet Explorer.
Click the Tools menu, and then click Internet Options.
On the Security tab, click the Custom level button.
Scroll down the Security Settings list until you see ActiveX
controls and plug-ins.
For Automatic prompting for ActiveX controls, click Enable.
Scroll down to Download signed ActiveX controls and click Enable or
Prompt.
Scroll down to Run ActiveX controls and plug-ins and click Enable or
Prompt.
Scroll down to Script ActiveX controls marked safe for scripting and
click Enable or Prompt.
Click OK, and then click OK again.
There is no way to overcome this issue except changing manually Internet explorer settings. Try checking if plugin works fine while changed settings. If its still not working or not showing any warning is display try checking console for other errors which are not related to active x. Good luck!
Does IE11 displays any message relative to the blocked execution of your ActiveX ?
You should read this and this.
Use the following JS function to detect support of ActiveX :
function IsActiveXSupported() {
var isSupported = false;
if(window.ActiveXObject) {
return true;
}
if("ActiveXObject" in window) {
return true;
}
try {
var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
isSupported = true;
} catch (e) {
if (e.name === "TypeError" || e.name === "Error") {
isSupported = true;
}
}
return isSupported;
}
There is no solution to this problem. As of IE11 on Windows 8, Microsoft no longer allows ActiveX plugins to run in its browser space. There is absolutely nothing that a third party developer can do about it.
A similar thing has recently happened with the Chrome browser which no longer supports NPAPI plugins. Instead Chrome only supports PPAPI plugins which are useless for system level tasks once performed by NPAPI plugins.
So developers needing browser support for system interactive plugins can only recommend either the Firefox browser or the ASPS web browser.
Here's how I got it working:
Include your URL in IE Trusted Sites
run gpedit.msc (as Admin) and enable the following setting:
gpedit->Local->Computer->Windows Comp->ActiveX Installer->ActiveX installation policy for sites in Trusted Zones
Enabled + Silently,Silently,Prompt
Run gpupdate
Relaunch your Browser
NOTES: Windows 10 EDGE don't have trusted sites, so you have to use IE 11. Lots of folk moaning about that!
We started finding some machines with IE 11 not playing video (via flash) after we set the emulation mode of our app (web browser control) to 110001. Adding the meta tag to our htm files worked for us.
Try this tag on the pages that use the ActiveX control:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10">
Note: this has to be the very first element in the <head> section.
In my IE11, works normally.
Version: 11.306.10586.0
We can test if ActiveX works at IE, in this site: http://www.pcpitstop.com/testax.asp

Kendo drop down list doesn't work in IE10 iframe

My mvc website makes use of the Telerik Kendo mvc dll's. However the problem is that the drop down list doens't work when running it on IE10, in a website that uses frames. When I run it on its own, it works fine, however as soon as it is used on a website with frames, it brakes the drop down list and they won't expand.
I'm currently using the latest version (2012.913) of the Kendo UI for MVC.
Is there a solution for this.?
I know this is an old post, but I thought I'd share since we had the same issue and found the fix for it. Unfortunately we are forced to continue using frames as well, so we had to put this fix in place.
First thing to check is if your using compatibility mode in the browser, whether by the site being added to the compatibility list or you're on an intranet site. If you can, disable compatibility mode and that should resolve this. If you want to ensure your site isn't using compatibility mode, add this tag to your application.
The problem we had is that IE doesn't obey this setting when using frames...it will always use whatever the parent frame is set to. We had to have compatibility mode enabled for certain portions of our site, so we were in a catch-22 situation. Since there's no way around this, our final resolution was to re-direct the user behind the scenes if they navigated to the page in the iFrame.
That being said, the easiest option is to add the meta tag above if you don't need compatibility view for anything.

Calling toggleSidebar in Firefox's browser.js

I've seen numerous references to browser.js while trying to create a Firefox sidebar. I don't have a good understanding of what this file is though. It has a method toggleSidebar in it. Can I call that method from a web page? Can I call it from a browser extension? Do I need to include browser.js in my extension somehow first? Can I call it from the add-on SDK or is it only available from the old style XUL extensions?
I don't have a good understanding of what this file is though.
It is the code driving the Firefox browser window, lots of code actually.
Can I call that method from a web page?
No. You can use window.sidebar.addPanel() to add a sidebar however.
Can I call it from a browser extension?
Yes.
Do I need to include browser.js in my extension somehow first?
No, it is already included in the browser window.
Can I call it from the add-on SDK or is it only available from the old style XUL extensions?
You can use it from the Add-on SDK as well but you will need to access the browser window directly - either via one of the low-level modules or chrome authority.

how to call 'onbeforeprint' function in Firefox

I'm developing one firefox extension. In that I need to inject some html elements, when print function is called, into the web page that has been loaded in the current browser tab. And then the page should be taken to the printer along with the injected html elements
I searched for and find onbeforeprint function in mdc
https://developer.mozilla.org/En/DOM/HTMLBodyElement
I'm unaware of using function. I tried using it as an event.
window.addEventListener("onbeforeprint",
function(){alert("Print called");}, false);
But it fails. Please, kindly help me in this regard.
As I understand, this feature was added just recently, and will only be available in Firefox 5 or 6.

Why doesn't GetMenu work on Mozilla menus?

I want to get the Mozilla menu handle but GetMenu returns zero. On Notepad it is true. Why?
Because Mozilla uses its own engine to display the menu, while Notepad uses the menu system provided by the Windows API.
If you need to read the menus then of course you can always use the accessibility APIs.

Resources