I'm working on some code to insert a link to a dupe in the SO close question popup:
What happens when you manually insert a link to a question in the textbox is that some JS kicks in and fetches the question belonging to the URL. However when I insert an URL using javascript (Chrome extension) into the textbox the SO javascript never kicks in to retrieve the question. The code I am using to insert the URL of the dupe is:
$(document).on('click', '.cvhelper-dupelist li', function() {
var url = $('a', this).attr('href');
var $dupeBox = $('#duplicate-question');
$dupeBox.val(url);
});
The above code successfully inserts the link in the textbox, however for some reason the SO javascript never kicks in to retrieve the question.
I've also tried the following to maybe force it to no avail:
$dupeBox.change();
and
$dupeBox.keyup();
To test what is happening you could open up the close as dupe popup (as above) of a random question and run:
$('#duplicate-question').val('http://stackoverflow.com/questions/8028957/headers-already-sent-by-php');
in the browsers console.