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

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 9, 2013, 05:29 PM   #1
drummingsoccer
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
Code:
[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
drummingsoccer
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

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
entire window moves when attempting to click and drag element in window HELP chlc MacBook Pro 0 Feb 10, 2014 04:08 PM
How to prevent javascript from closing window in a Webview App vivekuma Mac OS X 10.7 Lion 0 Jun 5, 2013 03:18 AM
Would love icons on finder window to incrementally bump window width 1611mac OS X 10.8 Mountain Lion 0 Jan 30, 2013 01:41 PM
Window flickers in Safari when resizing window Pegbiter OS X 0 Jun 13, 2012 08:14 AM

Forum Jump

All times are GMT -5. The time now is 07:40 AM.

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

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