I'm coding an google app script which grab selected text as parameter and open new window via a bookmarklet. I'm trying select&drag&drop
some text or link to web application input/textarea
which works on opened window example: https://script.google.com/macros/s/.../exec?article=
.
The problem is when I allow iframe with .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
and add https://script.google.com/macros/s/.../exec?article=
page in an iframe instead of opening in a new page; drag&dropping
text became disabled. Is there anyway to enable drag&drop text to iframe's input box?
drag&drop
is available in normal https://script.google.com/macros/s/.../exec?article=
page but not in an iframe.
Also thanks to comments I tried it on Firefox and it works, but still not on Chrome
GAS
function doGet(e) {
return HtmlService.createHtmlOutput('')
.append('<input type="text" id="kind" placeholder="Kind" size="4" value="' + (e.parameter.article?e.parameter.article:"") + '">')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
Logger.log(e);
}
Bookmarklet opening new page
javascript:if(window.getSelection)s=window.getSelection(); else if(document.getSelection)s=document.getSelection(); else if(document.selection)s=document.selection.createRange().text; open('https://script.google.com/macros/s/...GAS.ID.../exec?article=article'+(location.host=='scholar.google.com'?'':'&pdf='+encodeURIComponent(location.href))+'&bib='+encodeURIComponent(s.toString())+'bib');0
Bookmarklet adding iframe
javascript:if(window.getSelection)s=window.getSelection();else if(document.getSelection)s=document.getSelection();else if(document.selection)s=document.selection.createRange().text; iframe=document.body.appendChild(document.createElement('iframe'));iframe.style='position:fixed;bottom:0;z-index:99999;width:280px;'; iframe.src='https://script.google.com/macros/s/...GAS.ID.../exec?article=article'+(location.host=='scholar.google.com'?'':'&pdf='+encodeURIComponent(location.href))+'&bib='+encodeURIComponent(s.toString());0
*replace "/...GAS.ID.../" with web application id in bookmarklet