Javascript bookmarklet to take info from one page and submit it to form on another page -
Now when I came to know that I can not write Javascript in a page to enter form data on any other external page , D likes to do this with a browser-based bookmarklet
I can access the data on my original page with this bookmarklet code snippet:
Javascript: var% 20thecode = document.myForm.myTextArea.value;
If I manually open external web-based forms in the browser, this code changes into the text box:
javascript: zero (document) ExternalForm.externalTextArea.value = "Hello World");
and this bookmarklet will open a new browser window with external form:
javascript: newWindow = window.open ("http: // www ( Newlindro.com), "newwindow"), if (window.focus) {void (newWindow.focus ())}}
However, when I put these snippets together Trying to open an external window in a new window and to change the data, a single bookmarklet, I can not access any element from the new window, for example, in this new window Text field does not work to check the current values
javascript: var% 20newWindow = window.open ("http: //www.url.com," "new window" ); If (window.focus) {zero (newWindow.focus ());} window.alert (newWindow.document.externalForm.externalTextArea.value);
Once I'm new I use the bookmarklet code to open windows as a new window, so I do not think it is capable of reaching the elements within that new window. Any suggestions I'm missing? Thank you.
This is the reason that bookmarklet runs within the current web page's sandbox (environment). Since you do not have permission to access another page that does not have the same protocol, domain name and port, you are not able to access the document
to new window
When protocols, domains and ports do not match. BTW, the same is true for reaching iframe
s on a page.
As you are talking about "external form", I think that you do not live on the domain. Other examples will have to retrieve or manipulate data on the current page (at that time) and there will be no error.
Update: About Delicious (et al) Bookmarklet: Its code really reads:
(function () {f} = 'Http://delicious.com/save?url=' + encodeurIComponent (window. Location.href) + '& amp; title =' + encodeurIComponent (document.title) + '& amp; v = 5 & amp; ;; a = function (if (! Window.open (f + 'noui = 1 & jump = Doclose', 'deliciousuiv5', 'location = yes, links = no, scrollbars = no, toolbar = no, width = 550, height = 550 ')) location.href = f +' jump = yes'}; if (/f / Firefox / .test (navigator.userAgent)) {setTimeout (a, 0)} else {a ()}}) ()
So, yes, the parameters are transferred using only one Request
request.
Comments
Post a Comment