Showing posts with label internet explorer. Show all posts
Showing posts with label internet explorer. Show all posts

Friday, December 27, 2013

LinkButton OnClick Not Firing After OnClientClick

I worked around an oddball problem where the OnClick event of an ASP LinkButton would not fire following execution of some JavaScript tied to its OnClientClick.

The intent is to enable a row in a Telerik RadGrid to be removed by clicking the corresponding button in the row, and more specifically have a modal confirmation dialog appear to prompt the user to confirm their choice.

Here's markup for the GridTemplateColumn containing the button:
<telerik:GridTemplateColumn HeaderText="Remove" UniqueName="Remove" 
  FilterControlWidth="20">
    <ItemTemplate>
        <div style="cursor: hand;">
            <asp:LinkButton runat="server" ID="_RemoveItem" 
                Name="_RemoveItem" Text=" X " Font-Underline="False" 
                ForeColor="DarkBlue" 
                OnClientClick="confirmAspButton(this, 'Are you sure?'); return false;"
                OnClick="RemoveItemButtonClick" 
                style="font-weight:bold;color:red;">
            </asp:LinkButton>
        </div>
    </ItemTemplate>
    <HeaderStyle Width="55"></HeaderStyle>
</telerik:GridTemplateColumn>

The confirmAspButton function is a little JavaScript which is bound to the OnClientClick method of the LinkButton. If the user clicks OK, the confirmation passes and a postback will occur to execute the code beneath the OnClick method, whereas if they click Cancel the dialog will simply disappear.
     function confirmAspButton(button, message) 
     {
          function aspButtonCallbackFn(arg) 
          {
             if (arg) 
             {
                  window.__doPostBack(button.name, "");
             }
          }
            
          window.radconfirm(message, aspButtonCallbackFn, 330, 120, null, "Confirm");
     }


Seems simple enough, yet for some odd reason, in Internet Explorer 10, the LinkButton brought up the dialog just fine, and although the Cancel button click performed as expected, clicking OK had the same effect as cancel and merely cleared the dialog without executing the underlying code.

I managed to find a workaround via StackOverflow which suggests using a Button rather than a LinkButton. Sure enough, this did the trick, for whatever oddball reason whose particulars I could care less to dive into...




Wednesday, March 23, 2011

Manage Blocked Sites? Thanks, Google!

Google recently unveiled a tremendous new feature which allows you to block sites from their search results.

A feature previously only available as an extension for Chrome, users with a Google Account can now maintain their own, personal blacklist of sites whose search results aren't useful.

The original entry about this release on the Google blog tells the story, and you can click the following link to actually access your very own Manage Blocked Sites screen (assuming you're signed in to your Google account).

I mainly use Google, Bing, and Ask for my searches, but now Google is in my top spot solely for this feature. Too often I've submitted a query to a search engine only to be bombarded by useless results consisting of anything from advertising to porn to advertising about porn to malware, and habitually I'd just click the third or fourth page of results in the hope that I'd find some worthwhile content. Now I can shape my search results by eliminating much of the fluff, which translates into much more productive searches.

Creators of fluff are on notice:
"Sites will be blocked only for you, but Google may use everyone's blocking information to improve the ranking of search results overall."

Content is king, as the saying goes, and this is one big step in helping us mere users leverage the system by enabling us to trim away the fluff as we find it.

Well played, Google!


Monday, January 3, 2011

IE8 Process Priority in Windows 7

I wanted to bump up the process priority of Internet Explorer 8 under Windows 7.

There are at least a couple of ways to do this. If the app is already running, you can open Task Manager, right-click the app on the Applications tab and click Go To Process, then right-click the process name on the Processes tab and Set Priority to one of the levels above the default, Normal.


I chose a relatively quick-and-dirty method to create a batch file to boost the process priority of IE8, in conjunction with the START command, which can be tested via the Command Prompt.

Generally, the syntax is as follows:

     START /Priority ProgramName

Where /Priority is one of several values (Low, BelowNormal, Normal, AboveNormal, High, RealTime), and ProgramName is the name of a particular executable (EXE) whose priority you wish to boost.

I began with a simple batch file as a proof-of-concept to instantiate a High-priority instance of Notepad.

CLS

start /HIGH notepad



 



Success! Now I wanted to do something similar with Internet Explorer 8, and have it run with High process priority. The result wasn't quite what I wanted.


CLS

start /HIGH iexplore.exe





I'm running the 64-bit version of Windows 7, and have both the 32- and 64-bit versions of Internet Explorer 8 installed. Ideally I would've liked the 64-bit version to run, but it looks like by default the 32-bit one comes up via a command prompt if I omit the path (as I have lazily done here). That's no big deal, nor is the fact that there are two processes named iexplore.exe (see this article on Loosely-Coupled IE [LCIE] by Microsoft's Andy Zeigler regarding why IE8 creates two processes for itself instead of one). The problem is that neither iexplore.exe process has the desired High priority. I got around this by saving the batch file in the 64-bit version of IE's program directory, which by default lives here: 

     C:\Program Files\Internet Explorer

Now when I execute the batch file, START properly starts up one of the iexplore.exe processes at High priority.





But wait, why did it start only one process at High, and the other at Normal?? I'm not sure. I do notice, though, that unfortunately the process which appears to represent the default tab of IE8 that opens is the one set to Normal priority, which isn't exactly what I wanted. I can tell that this seems to be the case when I keep an eye on that process' CPU usage as I try browsing, as shown below.





Furthermore, as I opened additional tabs, which in turned spawned additional iexplore.exe processes in Task Manager, each of these too had only Normal process priority. Only the first process (note that the process with PID 87996 is High, while the second with PID 89476 is Normal).

The end result of this is that despite having set the priority of iexplore.exe to High via the START command in a shortcut, it seems to set this priority only for the "base" instance of iexplore.exe, not the instance which actually seems to be dedicated to browsing; not much help if your goal is to have browsing take precedence among the other activities of your applications. 

It looks like I may need to find some Windows settings specific to Internet Explorer or process priority elsewhere, whether by hacking the registry or some other means.


UPDATE 
1/4/2011

I stumbled upon a post on AskVG which links to a utility, Prio, which extends Task Manager to include among other things a Save Priority option, as shown below:




However, according to some of the comments in the article, some users of Windows 7 64-bit have reported problems getting their changes to process priorites to "stick" between reboots. 

I've installed the utility in a manner suggested by one of the commenters, woodburyadpost, who suggested the following installation steps:
  1. Install. DO NOT REBOOT. 
  2. Uninstall. DO NOT REBOOT. 
  3. Reinstall (and, presumably, reboot).

Curiously, the very first time I installed the utility, I received no prompt asking me to reboot, whereas after following the above steps, the installer did suggest a reboot. Perhaps this indicates the installer is missing something the first time through whereby a component isn't getting copied or installed on the system properly?

At any rate, we'll see if this works, and if so, it'll be a handy utility to have!


Friday, December 4, 2009

IE8 Blank Page, Can't Browse

After some recent Windows updates, I noticed that Internet Explorer 8 didn't seem to want to browse the web.

I'd open the browser, and it wouldn't even open my home page, it would just sit at a blank screen. I could tell it was doing something; if I clicked Help, the dropdown menu showed Customer Feedback Options as the only available item (ironically enough), everything else was grayed out.

Further, if I opened a new tab and chose Reopen Last Browsing Session, it would at least load my previous session just fine, but any attempts to browse beyond this failed, as if IE8 were just spinning its wheels.

I found a fix here which worked for me. The original forum post includes a modified version of the IEREREG batch file by Kai Schaetzl that works with 64-bit Windows, but the one I'm quoting below works specifically with 32-bit Windows. It has comments describing various symptoms each step intends to address, it's almost like electroshock therapy for Internet Explorer, it re-registers many of the system components it needs in place to function normally.
@echo off
echo.
echo IEREREG Version 1.07 for IE8 27.03.2009
echo by Kai Schaetzl http://iefaq.info
echo installs and registers (if suitable) all DLLs known to be used by IE8.
echo should only take a few seconds, but please be patient
echo.
REM ******************************
echo registering IE files
REM IE files (= part of setup)
regsvr32 /s /i browseui.dll
REM regsvr32 /s /i browseui.dll,NI (unnecessary)
regsvr32 /s corpol.dll
regsvr32 /s dxtmsft.dll
regsvr32 /s dxtrans.dll
REM simple HTML Mail API
regsvr32 /s "%ProgramFiles%\internet explorer\hmmapi.dll"
REM group policy snap-in
regsvr32 /s ieaksie.dll
REM smart screen
regsvr32 /s ieapfltr.dll
REM ieak branding
regsvr32 /s iedkcs32.dll
REM dev tools
regsvr32 /s "%ProgramFiles%\internet explorer\iedvtool.dll"
regsvr32 /s iepeers.dll
REM Symptom: IE8 closes immediately on launch, missing from IE7
regsvr32 /s "%ProgramFiles%\internet explorer\ieproxy.dll"
REM no install point anymore
REM regsvr32 /s /i iesetup.dll
REM no reg point anymore
REM regsvr32 /s imgutil.dll
regsvr32 /s /i /n inetcpl.cpl
REM no install point anymore
REM regsvr32 /s /i inseng.dll
regsvr32 /s jscript.dll
REM license manager
regsvr32 /s licmgr10.dll
REM regsvr32 /s msapsspc.dll
REM regsvr32 /s mshta.exe
REM VS debugger
regsvr32 /s msdbg2.dll
REM no install point anymore
REM regsvr32 /s /i mshtml.dll
regsvr32 /s mshtmled.dll
regsvr32 /s msident.dll
REM no reg point anymore
REM regsvr32 /s msrating.dll
REM multimedia timer
regsvr32 /s mstime.dll
REM no install point anymore
REM regsvr32 /s /i occache.dll
REM process debug manager
regsvr32 /s "%ProgramFiles%\internet explorer\pdm.dll"
REM no reg point anymore
REM regsvr32 /s pngfilt.dll
REM regsvr32 /s /i setupwbv.dll (not there anymore!)
regsvr32 /s tdc.ocx
regsvr32 /s /i urlmon.dll
REM regsvr32 /s /i urlmon.dll,NI,HKLM
regsvr32 /s vbscript.dll
REM VML renderer
regsvr32 /s "%CommonProgramFiles%\microsoft shared\vgx\vgx.dll"
REM no install point anymore
REM regsvr32 /s /i webcheck.dll
regsvr32 /s /i /n wininet.dll
REM ******************************
echo registering system files
REM additional system dlls known to be used by IE
REM added 11.05.2006 Symptom: Add-Ons-Manager menu entry is present but nothing happens
regsvr32 /s extmgr.dll
REM added 12.05.2006 Symptom: Javascript links don't work (Robin Walker) .NET hub file
regsvr32 /s mscoree.dll
REM added 23.03.2009 Symptom: Find on this page is blank
regsvr32 /s oleacc.dll
REM added 24.03.2009 Symptom: Printing problems, open in new window
regsvr32 /s ole32.dll
REM mscorier.dll
REM mscories.dll
REM Symptom: open in new tab/window not working
regsvr32 /s actxprxy.dll
regsvr32 /s asctrls.ocx
regsvr32 /s cdfview.dll
regsvr32 /s comcat.dll
regsvr32 /s /i /n comctl32.dll
regsvr32 /s cryptdlg.dll
regsvr32 /s /i /n digest.dll
regsvr32 /s dispex.dll
regsvr32 /s hlink.dll
regsvr32 /s mlang.dll
regsvr32 /s mobsync.dll
regsvr32 /s /i msieftp.dll
REM regsvr32 /s msnsspc.dll #no entry point
regsvr32 /s msr2c.dll
regsvr32 /s msxml.dll
regsvr32 /s oleaut32.dll
REM regsvr32 /s plugin.ocx #no entry point
regsvr32 /s proctexe.ocx
REM plus DllRegisterServerEx ExA ExW ... ?
regsvr32 /s /i scrobj.dll
REM shdocvw.dll hasn't been updated for IE7 and IE8, it still registers itself for the Windows Internet Controls
regsvr32 /s /i shdocvw.dll
regsvr32 /s sendmail.dll
REM ******************************
REM PKI/crypto functionality
REM initpki can take very long to run and is rarely a problem
REM if there are problems with crypto, SSL, certificates
REM remove the three following REMs from the lines
REM echo We are almost done except one crypto file
REM echo but this will take very long, be patient!
REM regsvr32 /s /i:A initpki.dll
REM ******************************
REM tabbed browser, do at the end, why originally with /n ?
regsvr32 /s /i ieframe.dll
REM ******************************
echo correcting bugs in the registry
REM do some corrective work
REM Symptom: new tabs page cannot display content because it cannot access the controls (added 27. 3.2009)
REM This is a result of a bug in shdocvw.dll (see above), probably only on Windows XP
reg add "HKCR\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32" /ve /t REG_SZ /d %systemroot%\system32\ieframe.dll /f
REM ******************************
echo all tasks have been finished
echo.
pause

Once I created and ran the batch file I created above, IE8 can now happily continue to force web developers to make absurd accomodations for its nonconformist self. BING!