I've developed a simple google chrome extension, that edits current page textbox values.
This is my content.js page
window.addEventListener ("load", myMain, false);
function myMain (evt)
{
try
{
var inputs, index;
inputs = document.getElementsByTagName('input');
for (index = 0; index < inputs.length; ++index)
{
// deal with inputs[index] element.
if(inputs[index].type=='text')
{
inputs[index].value='SampleValue';
}
}
}
catch(e)
{
}
}
This works fine for normal HTML pages.
BUT
This does not work for Salesforce visual force pages.
I've used
document.getElementById('SamplemainPage:mainForm:pageBlock1:pageBlockSection1:myId1').value='Sample Text';
at the bottom of my visualforce page, Then it works and change the value of my text box.
But when i put same code snippet to content.js it does not work.
How it is possible? because it says think content.js as a part of current web page. So i believe it should work