Basically, when I run this script in Chrome console, I want to get current url, open a new tab, and set it as a value of a textbox.
javascript:(function(){
var url=location.href;
var newtab=window.open('http://www.theyoump3.com/');
newtab.document.getElementsByName('url')[0].value=url;
})();
When I run the command I get exception in console:
Uncaught DOMException: Blocked a frame with origin "https://www.youtube.com" from accessing a cross-origin frame.
Its understood, the CORS problem. Is there a workaround? Passing a url parameter is not supported by that site.
Same problem occurs when trying this via iframe
var f=document.createElement('iframe');
f.src='https://www.youtube.com/watch?v=4J2zo7ArHnw';
f.style="position:absolute;width:400px;height:400px;z-index:99999;border:2px solid black";
document.body.appendChild(f);
of course it will work then src point to the same origin