Skip to content

Instantly share code, notes, and snippets.

@aurbano
Last active December 14, 2015 13:19
Show Gist options
  • Save aurbano/5092700 to your computer and use it in GitHub Desktop.
Save aurbano/5092700 to your computer and use it in GitHub Desktop.
iOS file opener (pdf, ppt, doc) for iframes where Safari won't enable scroll or download. Store as a bookmark on Safari, it will open a new tab with the found files.
javascript:var%20regex%20%3D%20%2Fhttp%3A%5C%2F%5C%2F(.*)%5C.(pdf%7Cppt%7Cdoc)%2Fgi%3B%0Amatch%20%3D%20regex.exec(document.documentElement.innerHTML)%3B%0Avar%20sourceWindow%20%3D%20window.open(%22http%3A%2F%2F%22%2Bmatch%5B1%5D%2B%22.%22%2Bmatch%5B2%5D)%3B
@aurbano
Copy link
Author

aurbano commented Dec 19, 2013

By the way the decoded JavaScript is:

var regex = /http:\/\/(.*)\.(pdf|ppt|doc)/gi;
match = regex.exec(document.documentElement.innerHTML);
var sourceWindow = window.open("http://"+match[1]+"."+match[2]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment