Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Jan 9, 2013, 05:29 PM   #1
macrumors newbie
Join Date: Jan 2013
Handling Javascript window requests in WebKit

Hello all, I've been a lurker here for a while but decided to finally make an account.

I have been designing websites with html and a bit of javascript and php for a few years now, and I have just recently decided to branch into programming actual applications. I learned the basics of C from various online resources and made a few projects, and have since moved onto Objective C.

Some people may find it easier to read about EVERYTHING at once and try to retain all that, but my approach for everything from html to obj-C has been to make many small projects to learn things in a hands-on way and learn to solve my problems and learn new things as I came across them.

Right now, I'm working on a simple browser with the WebKit framework. It's a document-based application in Xcode that works fine except for one thing. For some reason, I can't get javascript window requests to open properly. I've read the documentation on doing this and have implemented it exactly as specified in the documentation (bottom of the page). I handled the UIDelegate part by simply adding
[webView setUIDelegate:self] ;
to the top of the file. All the other things that I took from the documentation such as displaying the current page's title and url have worked fine, but this doesn't. When I click on something to open in a new window, a new window IS opened. However, it's a duplicate of the original browser window with nothing loaded in the WebView. I have search all over the internet and examined my code until my eyes hurt, and I can't figure out why it's not working! Is there some little snippet that's left out in the documentation?

I can provide the code if anyone finds it necessary, but you can simulate the problem simply by creating a document-based Cocoa application in Xcode, making a page (preferably one with a link to open a new window) open in a WebView, and adding the code for javascript window requests that is provided in the documentation that I linked above.

I assumed at first that this was being caused by me implementing a auto-loading homepage, but the problem persists even when I remove any code that could possibly be conflicting!

What am I doing wrong?

Last edited by drummingsoccer; Jan 16, 2013 at 09:57 PM.
drummingsoccer is offline   0 Reply With Quote
Old Jan 10, 2013, 03:06 PM   #2
Thread Starter
macrumors newbie
Join Date: Jan 2013
Okay, if no one has any info for me, is there perhaps a place where I could go that would be able to better answer my question? Some other forum, or a particular piece of documentation or site that I may have missed?
drummingsoccer is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 01:30 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC