Thanks, guys. there's a problem that i loaded other site's pages into my iframe. that caused i got permission denied when trying to access the DOM of the contained web page. It doesn't seem i can get around this permission issue.
Johan, I tried your suggestions. my domain of the web app is "http://localhost/" say the domain of the web page I included in an iframe is "http:// www.google.com/" I have @include-d both domains in my GM scripts. my GM script looks like this: .... .... if ('mybrowser' != window.name) return; .... var iframeEl = document.getElementById('mybrowser'); var doc; if ( iframeEl.contentDocument ) { // DOM doc = iframeEl.contentDocument; } var allLinks; allLinks = doc.getElementsByTagName('a'); // try to modify the css of all the links... ... .... here's what happened: 1. the window.name doesn't return anything, it's empty. 2. i got "Error: Permission denied to call method HTMLDocument.getElementsByTagName" when executing: allLinks = doc.getElementsByTagName('a'); This is caused by doc is not accessible. I can access its parent the iframeEl element though. so looks like we have no way to invoke GM on the iframe that contains external site's content. correct? thanks much. On Jul 18, 3:22 am, Johan Sundström <[email protected]> wrote: > On Fri, Jul 17, 2009 at 07:36, daremind<[email protected]> wrote: > > In the web app, I will have a portion of the web page that acts like a > > web browser. in the web browser, I can load any web page from another > > site. And then I'll add some javascript effects onto this web page. > > > What i'm doing inside this browser-like portion of the page can be > > done with grease monkey user script. however, the issue is whether > > this doable at all. More specifically: > > > What is this portion of the page? if I use an Iframe, i have domain > > permission issue so javascript can't modify it's content. If i use > > some div's, i need to parse like a browser to pull over js, css, etc. > > which is a mess. > > If it's an iframe, and your GM script can do its work inside of the > iframe without access to anything outside of that iframe, it's a piece > of cake; just make the iframe, point it to the url you want to show > and augment and make a GM script that @include:s that url (or perhaps > all URLs). Also, I'd suggest putting a name=mybrowser attribute on > that iframe. > > In the GM script, start with an "if ('mybrowser' != window.name) > return;" to make sure you're executing in the iframe context and > nowhere else. > > Then modify its DOM any way you please. > > > Is there some type of plugin that I can use to create such as area > > inside a web page so that i can use grease monkey user script on its > > content? or am i trying to do something grease monkey already did. > > > and did i make any sense to you? > > It's admittedly very, very fuzzy, and might clarify if you describe > one thing your greasemonkeying would do to the browse area. > > -- > / Johan Sundström,http://ecmanaut.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en -~----------~----~----~----~------~----~------~--~---
