mardi 26 juillet 2016

Way to simulate running javascript in web browser through using javascript itself

So what I'm trying to do is load window.open a page except the page that opens lacks scrollbars so what I tried to do was:

var script = win.document.createElement('script');
script.text = "$('body').css('overflow', 'auto');";
win.document.body.appendChild(script);

and obviously I get the permission denied error because of CORS. Anyhow, so I try running:

$("body").css("overflow", "auto"); 

via the web browser console (firefox) and it works; the scrollbar appearing as expected.

So all in all, I was wondering if there was a way to simulate running $("body").css("overflow", "auto"); on the web browser through javascript to get the same effect, and thus bypassing the same-origin error/protocol

(I hope it wasn't too verbose/confusing :D)




Aucun commentaire:

Enregistrer un commentaire