I am designing an exercise in an e-learning application. I have a template Google Spreadsheet and can display the spreadsheet within the software as an iframe.
Document URL (it's just a sample table)
https://docs.google.com/spreadsheets/d/1zmZ-oW8lC2Hus-G70O3CkhmGE5qqnoOGmSZMH6x526U/edit?usp=sharing
I learned about the /copy parameter that can be added to a url to generate a copy of that document so that the editing does not overwrite the original. Source: https://www.makeuseof.com/tag/make-copy-trick-sharing-google-drive-documents/
Spreadsheet URL with copy parameter
https://docs.google.com/spreadsheets/d/1zmZ-oW8lC2Hus-G70O3CkhmGE5qqnoOGmSZMH6x526U/copy
However, when I run that url as the iframe's source, it returns an error:
I learned that it is not the issue with the iframe, having tried the url on the w3 schools iframe demo with the same result. Source: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe
From this StackOverflow answer, I believe I understand that the iframe will not permit executing JavaScript within it and I expect that Javascript is being used to generate a copy.
Answer: Google Spreadsheets redirect
My question becomes, is there an alternative way for an end user (student) to generate a Google Sheets copy url and have that appear in an iframe in a homework lesson?
Desired Result:
This in the iframe (or equivalent):
and be able to edit that copy as their own document
Related
I used to embed Vimeo videos with this url format: https://vimeo.com/514607003 (only numbers). It works just fine. But some videos are in an other format and I cant embed them no matter what:
https://vimeo.com/605783608/493d2ee578
I'm getting this error on console when I try to embed it:
GET https://player.vimeo.com/video/605783608 404 (Not Found)
when I add the second Id of the video Url to the embedded Url, the error remains the same.
The answer appears to be to embed the video with a special query parameter h containing the second key:
https://player.vimeo.com/video/605783608?h=493d2ee578
This is determined by looking at Vimeo's own embed code; I did not find documentation explaining why this is.
I have an issue where I am trying to track the filedownloads on a website trough Google Tag Manager events. What I am doing is and already done on many websites is to find out if the "Click Url" contains any of the filetypes I am looking for like pdf, docx and so on. The issue here is that the Click Urls does not contain the information and are ending with .aspx. What is the best method to solve this issue?
I'd rephrase the question: what do these links (elements) have in common, that point to various downloadable files, and that is different from anything else, what is not a download link. This can be referred in GTM as a trigger.
Consider the following example:
<a class="button file_download" id="file_link_12" href="index.aspx?action=download&file_id=12">Download file</a>
If any of these can be identified in your HTML source code, then you can use these as triggers, which describes your elements used to point to downloadable files, e.g.:
Click Classes contains file_download
Click ID contains file_link
Click text equals Download file
Click URL contains action=download
If you are able to alter the HTML code, than you can choose any of these methods above, that bests suits your needs.
After uploading a PDF to the Media Archive, I am trying to link to it from a page on a site.
While editing content, I use the hyperlink tool then select the PDF I want to link to via the URL input box.
After saving and publishing the content, clicking the link downloads the PDF and I don't see any apparent way to make this view-able in the browser by using the current Media ID Composite provides. When rendered, we get this:
pdf
Is there a way that I can reference a PDF without using the Media ID and simply use the file name instead?
Here is the Request/Response header info:
After reading what Pauli Østerø said, I understand the problem but am still not able to think of a solution.
I can get the PDF to view in the browser by adding ?download=false to the href URL via Developer Tools. But when I try to add ?download=false to the href through Composite, it doesn't take affect and I get the console output: "Resource interpreted as Document but transferred with MIME type application/pdf: "http://c1.wittenauers.com/media/4afb7bc8-f703-469d-a9b2-a524d8f93dcb/ryc7iw/CompositeDocumentation.PDF"."
Here is the network trace that was asked for by Pauli. In the image, I included the bit where I add ?download=false to the URL, in source view, just in case there could be another way to add it.
Edit: URL and headers for the page.
Here is the link to the page that contains the link:
http://c1.wittenauers.com/cafe/test
Here is the headers for the page containing the link:
From what you're experiencing, it seems to me that Composite have gotten the MIME type of your uploaded file wrong, and is therefor not correctly telling the browser that this file is a pdf, and the browser doesn't know what to do with it.
Try deleting the file and uploading it again.
Try add ?download=false and the end of the href to the file. You prob. need to go into source mode of the content editor.
This is the exact line in the Source Code which is responsible for this behavior, and the logic is as follows
If there is no Querystring named download, the attachment is determined by the Mime Type. Only png, gif and jpeg will be shown inline, the rest will be shown as attachment.
If there is a Querystring named download with a value of false, it will override the Mime Type check and always force the Content-Disposition to be inline.
I made a quick test here to show that the behaviour is a expected. At least in my Chrome browser in Windows 8
Force download: https://www.dokument24.dk/media/9fdd29da-dde8-41f7-ba4c-1117059fdf06/z8srMQ/test/Prisblad%202015%20inkl%20moms.pdf
Show in browser: https://www.dokument24.dk/media/9fdd29da-dde8-41f7-ba4c-1117059fdf06/z8srMQ/test/Prisblad%202015%20inkl%20moms.pdf?download=false
Expanding on Pauli's answer, you can add the following snippet to your page template to automatically add the '?download=false' to all pdf links.
$("a").each(function () {
if (this.href.includes(".pdf")) {
this.href = this.href + "?download=false";
}
})
I'm writing a chrome extension where the standard popup page is used as a menu and I add a iframe at the bottom of the page to display some output. the display.html page contains the output I intend to display in the iframe appended to the page. This code inside my content script appends the iframe but it searches for a display.html page on the webserver rather than in the code packaged with the extension. Is there some way for me to get it to load my display.html page rather than one that may or may not be there on whichever page the extension is used on.
ifrm = document.createElement("iframe");
ifrm.setAttribute("src", "display.html");
ifrm.style.width = "100%";
ifrm.style.height = "20%";
document.body.appendChild(ifrm);
Updated answer
Per #Cnly's comment, please use chrome.runtime.getURL to get the URL of the embedded resource. (The original answer is extremely old, predating even manifest v2).
Original answer
I think you may want chrome.extension.getURL to get the URL of the embedded resource.
Hey,
Since Google Fonts came out, I have had this question in mind. First see this below:
<link href='http://fonts.googleapis.com/css?family=Cantarell&subset=latin' rel='stylesheet' type='text/css'>
Here Google is linking to an external CSS file that doesn't have a file extension (.css)! Then Google also has another feature that if you want to inlude another font to this then just add the "|" sign and type the font name. How do you do this? Using Javascript, PHP or something?
Help is appreciated!
Thanks :)
The extension of a file does not have to mean anything at all about the contents of said file. It is merely a convention (one that Windows, for instance, uses to the point of making it seem like a requirement).
Any dynamic 'file' on a web site can return what ever kind of content it wants, any time it wants. The extension means nothing - aside from expected convention.
That URL could be a directory named css with a default 'document' that is a script, which handles the parameters to decide what content to give. Or, it could be a literal file named css which does the same thing. Or, it could not be a file or folder at all, instead merely part of a routing mechanism, which calls a controller based on the URL, and passes the parameters in.
Web servers return information in the response indicating what the MIME Type of the return value is, and the browser determines what to do with it based on that - not based on the extension of the file.
Yes, they have to be doing some sort of server-side processing when this URL is requested
http://fonts.googleapis.com/css
The querystring is parsed, and a text stream is returned with the CSS output. Allowing the user to add additional font families to the CSS is pretty trivial, as the server is just spitting back what you append to the query string.
You could do this in PHP or ASP.Net (and many others), but there is no indication of the underlying technology from Google's URL.
The easiest way to do this yourself would be to create a folder on your web server called "css", and then have a default script in there that does the processing. The URL could basically be almost identical to the Google url.