Can’t set WPA-PSK on DI-524 D-Link Router?

[UPDATE] It is reported to work in Google Chrome. Thanks to the person who provided this feedback in comments.

[UPDATE] Without getting into much more detail about the reasons, please try using Internet Explorer and it will probably work. If you are keen on understanding why it fails, you can read on below. The gist is that there is a problem with the code that IE ignores. Thanks to the people who provided this feedback in comments. [UPDATE] It seems that IE8 has gotten better with standards. If you are using IE8 then you may have to use the solution described below. [UPDATE] It does not work with IE for Mac. [UPDATE] My edited page can no longer be downloaded. I am not sure if this is an issue with WordPress or elsewhere. You may still follow the directions in the post to do it yourself.


I have the D-Link DI-524 wireless router at home and it has worked wonderfully for me. I used to use MAC filters to block intruders from my network. Recently, I got tired of keeping the MAC list and decided to switch to using encryption. After doing a quick comparison, I decided to go with WPA-PSK. This is when I ran into an interesting roadblock. When I chose WPA-PSK, provided the passphrase, and clicked on the Apply button nothing would happen. Clearly, the form wasn’t being submitted. So did a View Source on the page and tracked down what was happening. For WPA-PSK, it was calling a Javascript function to do a check on the key (passphrase) before submitting the form. Within this precheck_key function it was calling another function that didn’t exist! So there it was, a pre-check that would never succeed and the form won’t submit. So what do you do? Actually, the resolution is not that difficult. Save the page locally as an HTML page. Edit the page to do the following:

  1. Comment out the call to the non-existing function. Replace it with return true; as followsfunction precheck_key(){ var auth = get_by_id("auth"); if(auth.selectedIndex == 0){ return true; } else { //COMMENT OUT: return check_key(); AND ADD THE FOLLOWING LINE return true; } }
  2. My router’s IP is 192.168.0.1, so I prefixed http://192.168.0.1/ to the form’s action attribute and to the Javascript file being included. You can do it to the img tags’ src attribute as well, though that is not critical. You just need to remember the position of the Apply button so that you can click on it.<script language="JavaScript" src="http://192.168.0.1/public.js"></script>and<form method=post action="http://192.168.0.1/h_wireless.cgi" name="form1" id="form1">
  3. Save the changes.

That’s pretty much it. Load the HTML file in a browser. The Javascript would interact with the router to show the current settings. You can now select WPA-PSK, supply the passphrase, and click on Apply. This problem may apply to the other encryption settings as well, but the fix remains the same. If you use Firefox, you can use the Firebug add-on to edit the page in the browser and make the change (only Step 1 needed). You don’t need to save the file, edit, and run in three steps. By the way, I also did a firmware upgrade to see if they have fixed it in a newer version but the problem exists in version 1.23 as well. UPDATE: [UPDATE] For some reason, the following download link doesn’t work anymore. It looks like WordPress or something else replaces the contents of the file with a dangerous content message. You should still be follow the directions above to fix the problem. On popular request I am posting My Edited Wireless Page (Right-click > Save Link As). This is an HTML file but named as PDF for technical reasons. If you want to try it, save as or rename as h_wireless.html on your local drive (Note that left-clicking on the link may try to open it in a PDF Viewing application and that will fail). Absolutely no liability can be assumed for using this file – you may use it only at your own risk. Before you can use this file you may need to edit this file if your router IP is not 192.168.0.1. If so, open this file in a text editor, search and replace 192.168.0.1 with the IP address of your router and save the file. Now log into your router (for example, by going to http://192.168.0.1 in a browser). Then open this file in the same browser window. Change the wireless security and click on Apply. That should be it!