Chrome extension: empty URL bar on created tabs - url

Currently, I'm working on an extension for Chrome, which is great fun so far, but now I encountered a little problem.
Generally, tabs that contain a file of the plugin have an empty URL bar (I'm using Chrome 13.xx), like shown in this screenshot:
This tab was created by the following code:
chrome.tabs.create({
url: chrome.extension.getURL('../relative/path/to/a/file.html')
}, function(newTab){
...
});
It would be nice to have the URL visible, so it can be shared with other people who have the same extension installed (the URL has a unique ID for the extension, if I'm not mistaken)

I don't believe it's possible for the time being. See issue 72021 for Chromium:
http://code.google.com/p/chromium/issues/detail?id=72021
You might just want to include the URL somewhere on the page and make it easy to copy for users (e.g. an <input type="text"> box wouldn't be much more intrusive than the URL bar itself).

Related

Cannot select PDF files in Chrome iOS using Dropbox

I have an issue using Wordpress's Media Manager whilst using iOS Chrome browser. It won't allow me to select any PDF files. It works fine in Safari but was wondering if there is any restrictions on Chrome, Dropbox or iOS which is stopping a user from selecting it.
I have checked that all the correct "accepted types" are correct. I'm sure it's not that. (Wordpress has added .pdf and application/pdf to type="file")
Code:
iOS Chrome (59.0.3071.102) This is the exact code for our File Input:
<input id="html5_1bka" type="file" multiple="" accept="image/jpeg,.jpg,.jpeg,.jpe,image/gif,.gif,image/png,.png,image/bmp,.bmp,image/tiff,.tiff,.tif,.ico,.asf,.asx,video/x-ms-wmv,.wmv,.wmx,.wm,video/avi,.avi,.divx,video/x-flv,.flv,video/quicktime,.mov,.qt,video/mpeg,.mpeg,.mpg,.mpe,video/mp4,.mp4,video/x-m4v,.m4v,video/ogg,.ogv,video/webm,.webm,video/x-matroska,.mkv,video/3gpp,.3gp,.3gpp,video/3gpp2,.3g2,.3gp2,text/plain,.txt,.asc,.c,.cc,.h,.srt,text/csv,.csv,.tsv,.ics,.rtx,text/css,.css,text/html,.htm,.html,.vtt,.dfxp,audio/mpeg,.mp3,audio/x-m4a,.m4a,.m4b,.ra,.ram,audio/x-wav,.wav,audio/ogg,.ogg,.oga,.mid,.midi,audio/x-ms-wma,.wma,.wax,.mka,text/rtf,.rtf,application/x-javascript,.js,application/pdf,.pdf,.class,.tar,application/zip,.zip,.gz,.gzip,.rar,.7z,image/photoshop,.psd,.xcf,application/msword,.doc,application/vnd.ms-powerpoint,.pot,.pps,.ppt,.wri,.xla,application/vnd.ms-excel,.xls,.xlt,.xlw,.mdb,.mpp,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.docx,.docm,application/vnd.openxmlformats-officedocument.wordprocessingml.template,.dotx,.dotm,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xlsx,.xlsm,.xlsb,.xltx,.xltm,.xlam,application/vnd.openxmlformats-officedocument.presentationml.presentation,.pptx,.pptm,application/vnd.openxmlformats-officedocument.presentationml.slideshow,.ppsx,.ppsm,application/vnd.openxmlformats-officedocument.presentationml.template,.potx,.potm,.ppam,.sldx,.sldm,.onetoc,.onetoc2,.onetmp,.onepkg,.oxps,.xps,.odt,.odp,.ods,.odg,.odc,.odb,.odf,.wp,.wpd,.key,.numbers,.pages,.bz2,.jpeg,.jpg,.mp4,.onetoc,.ppt,.tgz,.txz,.txt,.wpd,.xz,.jpe">
Screen shots:
I've seen another site working and looking at the code I could see that they didn't specify an "accept" attribute. I remove it and tested. It still doesn't allow PDF selection. Totally stumped.
Try removing all the file types in the accept attribute. Removing the entire attribute altogether didn't work for me.
Your input html should now look like:
<input id="html5_1bka" type="file" multiple="" accept="">
In order to fix this in Wordpress you might have to write a bit of custom JS to listen for wp.media, open event
How to Trigger some JavaScript when Media Popup is opened?

Angular JS and jQuery Mobile routing - treatment of hash anchors in the URL

This is my first question on SO so i'll try and make it as clear and as understandable as possible.
I've recently started messing around with Angular JS and currently I am working on a mobile app using Angular JS and jQuery Mobile. So far I've not had any major problems and so far have no had a need to consider any external libraries for integration (such as the angular js + jquery mobile adapter). I've created a multi-page app (currently only two pages) and used separate controllers for each page (login + content page). The app itself is simple, it's just a list keeping app and i've created a quick jsfiddle based on the ui aspect of the content page: http://jsfiddle.net/G7JNV/4/
The app works as expected from the jsfiddle. However because the content page is a page in the same html document (index.html) as the login page, to navigate to the content page the url becomes:
.../index.html#mainpage
(mainpage being the page for the list keeper)
Thats when things start getting funny. When the url is like above, when adding an item to the list, the item is initially unstyled (it doesn't look like it's part of the list) but the css styling for that item comes back after adding another item. Of course the next item is then unstyled (and so on).
If you want to see what the issue looks like:
Everything however works fine if i don't have the hash page as part of the URL (I tested this by turning the two page app into just one page for the content so that .../index.html goes straight to the content page). The css is applied to the dynamic content fine as one would expect.
Of course I have no idea why it's doing this and I suspect that it's something to do with how angular and jqm treat the hash anchor in the URL (but bare in mind I don't have much experience in both Angular JS nor jQuery Mobile).
Any help from any of the more experienced Angular JS (and jQuery Mobile) users would be greatly appreciated!
You should be creating a directive that encapsulates the list and the logic that you have for it.
As suggested in the comments to your questions, a timeout can work. If you're having issues with the element "flashing" or "flickering", you can use the ngCloak directive to deal with this.
You may also want to check out the $locationProvider configuration in your app and turn off HTML5 mode or set the hash prefix.

Safari ignoring/removing anchors (or "hashtags") when clicking hyperlinks?

I need to point one page to another and then scroll to a particular section. In Chrome and Firefox, using an URL like www.example.com#section1 does the trick. (#section1 can be an anchor or an element's id).
However, in Safari, the hash disappears when I click the link.
Why is this happening? Is it possible to do it on Safari? If not, how can I get around this problem?
When using hyperlinks that point to inside sections on other pages you must remember to add a slash (/) before the hashtag for cross browser compatibility.
Eg: www.example.com/#item-1
doing www.example.com#item-1 isn't accepted by all browsers (apparently by Chrome and Firefox it is)
Case: I have parameters after '#' like url#myParam=123, when I changed params like
url#myParam=789 Safari sometimes loaded previous page based on myParam=123,
although in Address bar it showed myParam=789
Solution : Use url?#myParam=123, then Safari will everytime load new page.
Using '?' before '#' solved my problem.
I had a related problem with Safari (on iPhone/iOS) seemingly stripping off the hash/fragment when doing a:
var newHash = ...;
window.location.replace("#" + newHash);
The actually problem was a javascript error that only appeared on Safari. Since I could not easily assess a javascript console for the iPhone, I chose to download an old version of Window's Safari (related post, download).
Then, I could replicate the problem from the iPhone on my Window's desktop using the old version of Safari. At that point, I found a javascript tag had a missing ']'. This was a legitimate bug, but it was somehow ignored by Chrome, Firefox, and IE.
The window.location.replace() was not even being called, because the code was breaking out on the javascript error. So the problem wasn't that Safari was stripping the hashtag, even though it appeared that way from multi-browser testing.
I just experienced an issue like this. I was using a URL re-write in the asp.net web.config. With Safari, the hash and everything after was removed. After trying some of the things mentioned above I was still having problems. The issue for me was that this was all happening under HTTPS. Once I specified the full URL in the redirect and included the https:// scheme the redirect worked correctly and preserved the hash. Note this wasn't an issue with Chrome or Firefox.
For me it was the exact same issue like mrbinky3000 has stated above: The server mod-rewrite was killing the hash in safari.
The solution was to use a full absolute link like:
http://www.example.com/path/#item-1

Cannot type into an editor in a xul panel

the Cannot type into an editor in a xul panel is a known bug in firefox.
I simply want to reuse my code from my google chrome extension by hosting a webapp online and including it in the extension both google chrome and firefox by using a popup window.
This is how I include the webapp
<popupset id="mainPopupSet">
<menupopup id="smsflatrate-popup">
<iframe height="500px" src="http://webapp.mysite.net/"
flex="1" type="content-primary"/>
</menupopup>
</popupset>
The problem is, it is possible to focus input elements but the input fields do not react on key-events, so no input can be provided.
It seems that there is some kind of solution for this problem, but I think I do not really understand what to do here.
E.g. from the link above, what would be a solution according to this post?
There are many ways to display HTML in a XUL UI:
1) including HTML inline in the XUL document. This should work fine everywhere,
including in panels.
2) include an HTML IFRAME in the XUL document. This currently works fine
everywhere, except that IF the iframe is in a panel, there are some problems
with focus. This bug is about that one issue.
3) instead of a panel, you can create a XUL window using window.open that
contains HTML inline or in an IFRAME, and everything should work.
Having said that, if I open this bug's testcase in a Firefox trunk build, I
*can* tab into the textbox and type into it, so it looks like focus is
basically working now? The problem is that I can't focus the textbox by
clicking on it. In fact, if you click on the arrow to do a search, you navigate
to a new page where there is a textbox that you *can* click to focus.
So I think we have here just some simple bug that's preventing click-to-focus
from working, sometimes. Enn, can you look into that?
It seems to me that given the list of suggestions your best choice is to open a new window to represent your popup. You can make it look like a popup by setting its position, turning off OS crhome, etc.

Opening my JQTouch Iphone WebApp for the home icon, why every external link open in another safari window?

Using the JQTouch library, usely links like the following ... should open the new page in the SAME window. That works fine when I go to the site using Safari BUT when I launch the site from the home saved icon, it opens a fullscreen site and on the first link it opens a NEW Safari window. How can I make it stay in the same original fullscreen window?
You have to set the target to _webapp. E.g:
<li class="arrow">Some Page</li>
and then it will load on the same page.
You need to look into manifest files.
The manifest file declares what files (html, javascript, css, jpgs etc.) that the iPhone should cache in order to make a webapp work offline. A part of the manifest file is used to declare which URLs are OK to use when in full screen (webapp) mode.
Specifically look at NETWORK in manifest files.
Example:
NETWORK:
*
This should allow access to any URL you like, and stay in webapp mode.
Alternatively use target="_self" - I haven't seen target="_webapp" anywhere.
/Mogens
One solution I found here is to change the way you write your links for a mobile app. Rather than a href='link.url' you'd write a href="javascript.window.location.href='link.url'"
Dislaimer: I haven't personally tried this yet, so I can't guarantee it will work. But logically, it does make sense.
Using target="_webapp" works only if you remove the rel="external", you cannot have both.

Resources