0

I am trying to change .url file generated by IE as a favorite file. I have the following code in C#:

string[] lines = File.ReadAllLines(filename);
lines[1] = "URL=javascript:{alert('this is a test');void(0);}";
File.WriteAllLines(filename, lines);

The .url file opened in Notepad looks like this (the code is of a bookmarklet that will change over and over):

[InternetShortcut]
URL=javascript:{alert('this is a test');void(0);}

The problem is IE does not see get the changes until it is closed and re-opened. How do I make it, reload the new URL?

mpora
  • 1,411
  • 5
  • 24
  • 65
  • Most likely, you can't. That is likely just the way it is. What you may need to do to achieve this goal is to use IE's API to add or modify bookmarklets. Before you get into that mess though, I'd personally try to think of a different way to achieve your goal. Given that a bookmarklet is itself software, it seems to me you should be able to build in the necessary flexibility such that you don't need to update it. – DG. Feb 07 '13 at 00:27

1 Answers1

0

Only solution now it to open another instance of IE.

mpora
  • 1,411
  • 5
  • 24
  • 65