WebKit shell browser for internal web application - xcode

I am creating an in-house web application that I want to run in a WebKit shell browser on the Mac. I searched and came up empty. Basically, I want the site rendered and shown in a window with no chrome for navigating to other pages, bookmarks, etc. Seems to me that there should be a relatively easy way to get something like that up and running in Xcode, but alas I don't know how. The more barebones the better. Anybody know the answer?

Not sure if this is what you're looking for, but you could use a WebView. The content is rendered by Safari/WebKit.
As for chrome, if you just put the view, that's all you'll have. You can shape the rest of the User Interface however you'd like.
Apple's documentation has a couple of examples using WebView... Should this solve your problem.

Did you take a look at the phonegap mac project.
Its a full screen webkit without any chrome in which you can put your html / css / javascript to run:
https://github.com/callback/callback-mac

Related

Scraping an Angular website with selenium and C# returns the angular script, not the rendered web page

This seems to be by design as far as I can tell. Selenium can see the initially loaded HTML, but not the HTML after it's been massaged. I've tried IE, Chrome and PhantomJS and they all show the same behavior. So does the built-in Chrome debugger, until you inspect an element on the page, you can't query any of the rendered HTML.
I'm looking for any suggestions about how to scrape the web page. The only option I see right now is finding the chrome process, triggering the inspector, clicking inside, then running the Javascript. Needless to say, this sounds fragile.
I also haven't been able to find anything on capturing the Ajax calls from selenium so I can make them and capture the JSON. When tried copy / paste from the chrome network tab into selenium I got a missing application block message.
Does anyone have any other advice?
Since I can replicate the issue in the chrome debugger, I don't see posting code as useful. It looks like a design decision.
Ralph
Sadly, I wasn't able to do things in a straightforward way. Instead, I used Selenium to do the login and navigate to the page, then use windows API calls to click inside the window send ^a^c to copy the data and an absolute location to click on the button to go to the next page.
The site is set up so that ^a^c copies the raw data for this site. I don't know if that's standard for Angular or not.
Fragile, but it works.

How to check the css display value (block, inline, etc) for element in Firefox Web Developer tool?

I am quite sure that with the good old Firebug, it was shown in the Layout tab, together with the box-sizing property.
Is it possible to tell in the Web Developer too? There is a Box Model tab which is quite similar to the Layout tab of Firebug, but it does not show this information.
Btw: I thought the built-in Web Developer was built on Firebug, but when reading about it it actually seems that they are two quite separate things.
That feature is currently only available in Firefox Nightly.

Finding the origin (URL) of a dragged and dropped image/text on a cocoa application dock tile on 10.6.8

I have just started coding an application in cocoa on OSX 10.6.8. It is well underway mostly thanks to threads I have found here. For the subtle functionality I am about to explain I've looked everywhere and really have given it my best without success. Here is the situation:
There is a browser (chrome for now but the solution should be adaptable to FF and Safari at least)
There is my chrome extension
There is my desktop app
Text/images can be dragged on my desktop app which then organises these items by source.
For a file/text from finder, except a web browser, tagging the file with its file path is the desired behaviour, for a text I simply put clipboard as the source. Now the issue is that files/text dragged from a web browser should have the website they were dragged from as the source. There is an easy fix for files: I have an extension which sets a buffer with the last active url so that all I need to check when a file is dragged is whether it comes from the chrome cache to tag it with the content of the said buffer. My problem is for text. The way text dragging is handled is by using a service which I declared in the .plist, There is a similar unanswered question on SO and a technique that seems as if it could work but it is only available for 10.7 on. I also found a link where someone managed to get the url for itunes songs dragged on his application using http://www.mail-archive.com/cocoa-dev#lists.apple.com/msg17452.html
Is there a solution to see the URL of a dragged image/text that could be handled using only cocoa?
The only other option I see is using the extension to inject javascript code into all webpages for handling the 'dragenter' event and send the content of what is being dragged together with the source URL to the desktop app via a custom protocol. I'm not too keen on script injection and I sense some complication down that path as well.
In any case thank you for your help!
Chocozor.

Shadowbox not working in Firefox

I have a strange problem.
I have integrated shadowbox plugin into my drupal web and it works with Opera, Chrome and IE9, but it doesn't work with Firefox 14.
I've noticed that in Firefox rel="shadowbox" attribute is not added to the link of an image, so that should be the reason.
How could I solve this?
The whole idea of Shadowbox is (usually) that you if add the rel="shadowbox" to a link, it will show the Shadowbox. Are you really sure that the attribute is not added in Firefox? Because if that is the cause, you're probably doing something extremely weird at the server side.
Are you trying to add the attribute using some client side code? Because then maybe that code gets execute after Shadowbox registers its event bindings. You might consider changing that code to really add shadowbox to the link, instead of just setting the attribute. Shadowbox provides a fairly decent API to do exactly that.

Webkit page scaling in Cocoa

I'm making a WebKit-based text editor app for Mac, and I need to find a way to zoom the document in and out.
I've seen this StackOverflow article here, it suggests just scaling the view that Webkit is rendered into. The problem is, since Webkit doesn't know about it, this breaks things like drag & drop and causes Javascript to report the wrong cursor locations. Unfortunately, for some reason, the Cocoa WebKit API only supports scaling text up or down, not the whole page.
Safari and Chrome are both able to do this properly. I've gone as far as to look through the Chromium source code to figure out how it's done, but unfortunately it's using a completely different cross-platform API.
Any advice would be greatly appreciated. I'm not opposed to using private APIs, if I can figure out how to use them in a safe way.
-Keaton
The APIs for doing this aren't currently public, but they've been around for years and aren't likely to change. You can find them in WebKit's WebViewPrivate.h header. You won't find that header on your system, so you'll have to redeclare those methods yourself in a category. Something like:
#interface WebView (Zoom)
- (IBAction)zoomPageIn:(id)sender;
- (IBAction)zoomPageOut:(id)sender;
- (IBAction)resetPageZoom:(id)sender;
#end
Another option is just to set the CSS zoom property on the html element in your editor. You can do that in markup (<html style="zoom: 1.5">) or in JavaScript (document.documentElement.style.zoom = "1.5"). That doesn't require using any private APIs.

Resources