Applescript to open URL in Safari without titlebar...almost working :-)

Hi guys,
I'm trying to open an URL in Safari with applescript, and i don't want any toolbar in the opened window, actually this code almost works but it open 2 windows as the javascript is executed from document 1
I use Javascript because i dont want to have any modifications of Safari preferences, so when i close it and reopen it should not have the toolbar hidden.
<pre class="jive-pre">tell application "Safari"
activate
tell document 1
do JavaScript ("window.open('http://www.google.com','_blank','titlebar=0');")
end tell
end tell</pre>
Does anybody knows a way to make this work or to open a window without the toolbars ?? I've tried different things but i'm stuck, so any help appreciated.
Thanks by advance,
Max

This is about the best you're going to do using JavaScript...
<pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
title="Copy this code and paste it into your Script Editor application.">tell application "Safari"
activate
set theURL to URL of document 1
set windowID to id of window 1
do JavaScript ("window.open('" & theURL & "','_blank','titlebar=0');") in document 1
close window id windowID
end tell</pre>
The above script opens a new window with the current document's url and then closes the original window. As far as I've read you cannot get JavaScript to act upon the current window.
Hope this helps at least a little...

Similar Messages

  • The Open URL or File function is not working when I publish as a exe?

    The Open URL or File function is not working when I publish as a exe.  I have tried putting the exe in the same location as the files with no luck.  How do I get the buttons to function properly with a exe file.

    Have you set the Publish folder as a trusted location in Flash Global Security?
    If not, please read this post:
    http://www.infosemantics.com.au/adobe-captivate-troubleshooting/how-to-set-up-flash-global -security
    It may explain your issue.

  • Quizzes: Open URL on current window don´t work

    I'm using the open URL in current window option for both results pass or fail, if I pass it works fine, the new URL opens in the same window but if I fail it opens in a new window. How can I fix it ??
    Thanks in advance.

    I'm using the open URL in current window option for both results pass or fail, if I pass it works fine, the new URL opens in the same window but if I fail it opens in a new window. How can I fix it ??
    Thanks in advance.

  • Open url from top navigation bar in work area

    Hi.
    I added in top navigation bar one link (component CRMCMP_HDR_STD, view MESSAGE). How i would like to show content of that url in workarea of web ui window.
    I know that I can call url with href, but the problem is that this url content is then shown in that top navigation bar which is very small. I also know how to show that content in new window.
    But as I said Iwant to show it in workarea window. Like for example if you click on Personalization link in navigation bar.
    I checked how this Personalization call works in standard but it is somewhove hardcoded.
    Any ideas? Help will be appreciated.

    I would have even bettter requirement. I developed Z component. And I want to call this Z component from navigation bar link (component CRMCMP_HDR_STD, view MESSAGE).
    But as I said, I don't want to open that Z compoennt instead of CRMCMP_HDR_STD component in top bar, but in workarea. The requirement is similar as when you would click on any option in left navigation bar, which then opens component in workarea. But I don't want to launch my Z component from left navigation bar (which I know how to use), but from top navigation bar.
    Help appreciated.

  • Can't open URLs in outlook 2010 email. Works OK when IE is default browser. URL opens properly when I paste it into FF.

    Running Win 7, Outlook 2010 and FF 3.6.15. I used to have no problem clicking URLs in Outlook messages, but now, when FF is default browser, I get message: "General Failure. The url was: "http://.....". An error occurred sending the command to the application." Link opens OK if I copy url to FF. Also works when IE is default browser.

    Every single time that I have to do an update on Firefox I then have to go back into the regedit and follow the directions again in order to prevent this error. The issue should be corrected by Mozilla on their next update. To be honest, it is kind of annoying!! This has been an issue for several months, and I am tired of having to fix their mistakes!''' MOZILLA!!! PLEASE FIX THIS ISSUE!!!'''
    I HAVE ATTACHED A SCREEN SHOT OF THE ERROR THAT I AM GETTING.

  • Open URL in new window function not working.

    Please please please can someone help. The openURL function that I have linked to a button and a click box will just not work anymore in a new project. I have searched everywhere for an answer and all I can find is that it is something to do with a flash update preventing this and some code was provided as a work around. However I only have captivate 4 and 5 and have no way of editing this code to allow the new windows to function. If these functions are no longer available within captivate then captivate is nolonger any use to me. Can anyone help?

    Welcome to our community
    See if the link below is what you are after:
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • MacBook Pro won't open pages in Safari or Chrome; wifi works on other devices fine.

    Using OS X; software is updated. I am not very computer savvy, so I have NO IDEA how to diagnose the issue. And i am sure I haven't provided enough info, but I don't know what is important to diagnose the problem. HELP!

    Power Cycle
    Power off the router. Unplug it from the wall. Wait a while.
    Plug it back to the wall. Power the router on. Wait until all the lights are lit properly. It will take a while.
    Restart the computer.
    Start up in Safe Mode.
    http://support.apple.com/kb/PH14204?viewlocale=en_US

  • [iPhone] How to POST url in safari

    Hi!
    I want my app to open url in Safari and to login.
    I know how to just open URL:
    UIApplication *app = [UIApplication sharedApplication];
    [app openURL:[[NSURL alloc] initWithString:@"http://www.somedomain.net"]];
    But there is a login form on that site. Here is it's code:
    <form action="http://www.somedomain.net/login.php" method="post">
    <td width="68%"><input name="username" class="formlogin" size="23" type="text" /></td>
    <td width="10%"> </td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input name="pass" class="formlogin" size="23" type="password" /></td>
    it looks like I have to POST params to http://www.somedomain.net/login.php
    Well, I know how to POST
    NSString *myRequestString = @"username=sampleuser&pass=samplepass";
    NSData *myRequestData = [NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length ] ];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://somedomain.net/login.php" ]];
    [ request setHTTPMethod: @"POST" ];
    [ request setHTTPBody: myRequestData ];
    NSURLConnection *connection = [[NSURLConnection alloc]
    initWithRequest:request
    delegate:self];
    [connection release];
    [request release];
    But how to combine it all together? Just POSTing and calling openURL does not work. Is it possible at all? openURL opens safari and GETs? What if a site could log me in on GET request with username and pass as params, would openURL work then?

    No, you cannot specify a request method in a URL.

  • Open URL or File button not working.

    I am using VMWare on a Mac running Windows XP with Captivate 4.
    I am trying to essentially put a link at the end of my elearning to have them jump to a URL.  I've switched over to a dell running XP.  I've created a new project and tried to recreate just the last slide, i've created another new project and tried to just make a open URL button but none of it works!
    any thoughts?

    Hi Patrick
    We can all honestly give thanks to those that like to wreak havoc on our computers. Malicious Hackers
    For it is Security reasons we face the difficulties we do.
    Try the link again. I initially pointed you to the wrong anchor. (Sorry - My bad) Basically it's a Flash Player security thing. And it only happens when you test locally. Once things are on a server (as they usually are) the issues tend to become total non-issues)
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Applescript to open current Safari URL in Chrome?

    I have decided not to install Adobe Flash in Lion. I did the same in Snow Leopard about six months ago. When I need to cheat I use Chrome to open flash-based content because its flashplayer is baked-in i.e. I don't have to download and install the plug-in from Adobe.
    In Snow Leopard I found an applescript that allowed me to open the current Safari URL in Chrome. I placed it in Snow Leopard's ~/Library/Scripts/Applications/Safari/ folder. This created a persistent (always present) Script menu in the Finder's menubar. This applescript became a clickable item in the Script menu whenever Safari was the frontmost application.
    An alternate method to run the same script: I placed it in Snow Leopard's ~/Library/Safari/Scripts/ folder. In this case the Script menu was present only when Safari was open *and* it was the frontmost application.
    In either case, I could run the applescript from the Script menu whenever I wanted to see a webpage's flash-based content. In Lion, the Script menu does not appear with either method when attempting to run scripts in Safari.
    Am I doing something wrong?
    On a related note: I also used scripts in Snow Leopard to help manage my iTunes library. The Script menu appears and the iTunes scripts successfully run in Lion using the second method above i.e. when placed in the ~/Library/iTunes/Scripts/ folder. In Lion, the Script menu does not appear in Finder when I drop scripts into the ~/Library/Scripts/Applications/iTunes/ folder.

    Have you checked the box “Show Script menu in menu bar” in the general preferences of the AppleScript Editor?

  • Send URL from Safari to Delicious via Applescript

    TIP: this will get the url, send it to a window loading delicious api, set the window nicely to a dialog kind of size, tags etc etc. After logged in it will remember the account settings ofcourse...
    This is the best option for me as I can try to make it crossplatform. As Firefox 3 has not as much extensions at the moment... yet as well as other beta browsers etc etc
    I was searching for a simpel solution yest working and this is working allright.
    Next step is a widget for all my bookmarks... sure there is one??? or not...
    Ciao!
    Applescript to save url bookmark to Delicious from Safari :
    Note : account name you have to set in the url pretty straightforward,,,,
    Valentijn, Netherlands
    tell application "Safari"
    set theurl to (get URL of document 1)
    end tell
    tell application "Safari"
    activate
    open location "http://del.icio.us/YOURACCOUNTNAME?noui=yes&jump=close&url=" & theurl
    set bounds of window 1 to {200, 200, 900, 550}
    end tell

    Hello Kappy,
    maybe my question was misleadingly formulated.
    I use Safari (by Apple) on Macbook Air (by Apple) and when sending links I want to use OS Yosemite Mail App (by Apple).
    Currently Chrome is opened. I DON'T want to use chrome.
    Mail App INSTEAD of chrome.
    I hope this IS the right place to ask the question: How do I teach safari to send mails by the native OS X mail app?

  • HT1677 In safari browser cookies is working fine. But when I add the browser url to the screen then the cookies concept is not working. In safari setting cookies is always open only. Can you please provide any information regarding to this?

    In safari browser cookies is working fine. But when I add the browser url to the screen then the cookies concept is not working. In safari setting cookies is always open only. Can you please provide any information regarding to this?

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings and disables most add-ons (extensions and themes).
    ''(If you're using an added theme, switch to the Default theme.)''
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu by clicking on the '''Restart with Add-ons Disabled...''' menu item:<br>
    [[Image:FirefoxSafeMode|width=520]]<br><br>
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.
    Thank you.

  • Applescript to copy selected text plus page URL in Safari

    I do a lot of online research. I would like to be able to select text then run an applescript to add the selected text plus the page URL to the clipboard. I have found a couple scripts that come close to what I want to do, but they don't work. They get the URL and usually some other information, but instead of the slected text, I get "missing value". Does anyone know how I can make this work?
    The scripts I found that do kind of what I want, but don't work are:
    http://allancraig.net/index.php?option=com_content&view=article&id=113:saving-se lected-text-and-url-from-safari-to-a-file&catid=40:applescript&Itemid=91
    http://hints.macworld.com/article.php?story=20080207080505152
    This script works, but it copies URL and page title rather than URL and selected text:
    https://gist.github.com/70565
    I would be so grateful for some help on this.

    After looking around a bit more –
    first here: https://discussions.apple.com/message/9643814#9643814
    then here: https://discussions.apple.com/thread/3197130?start=0&tstart=0
    – I was able to cobble together this script:
    tell application "Safari"
      activate
              set theURL to URL of front document
              set selectedText to (do JavaScript "(''+getSelection())" in document 1)
              set theDate to do shell script "date +'%d-%m-%Y'"
      set the clipboard to theURL & return & selectedText & return & theDate as string
    end tell
    which does the trick very nicely. (I added the date to make it easier to do my references in college assignments.) I used Automator to save it as a Service and assigned a a keyboard shortcut (option + c). I believe this will speed up my workflow tremendously.

  • How can I have one thing open in Safari on my MacBook Pro and search for another thing in Safari without closing out of the other? For instance, How can I leave Pandora playing while I search Facebook?

    How can I have one thing open in Safari on my MacBook Pro and search for another thing in Safari without closing out of the other? For instance, How can I leave Pandora playing while I search Facebook?

    With Safari open use the Command + T keyboard shortcut to open a new tab.
    Or, Command + N to open a new window.

  • How can i open a pdf in safari without the screen turning black?

    How can I open a PDF in Safari without the screen turning black?

    Welcome to Apple Support Communities. We're all users here.
    Depending upon your version of OS X and your version of Safari, as detailed in the Adobe help document links below, Adobe pdf documents created with the latest releases may require an (updated free) Adobe plug-in for Safari, or (free) Adobe Reader in order to display properly.
    http://helpx.adobe.com/x-productkb/multi/safari-5-1-incompatible-reader.html
    http://www.adobe.com/support/downloads/product.jsp?platform=macintosh&product=10
    I encountered the problem recently when attempting to view documents from a financial institution.

Maybe you are looking for

  • Using Flash Pro and Flash Builder together | Learn Flash Professional CS5 & CS5.5 | Adobe TV

    Adobe Flash Professional CS5 and Adobe Flash Builder 4 enable time-saving workflows. Learn how to develop content in Flash while editing associated ActionScript code in Flash Builder 4, switching easily between the two applications to edit and test.

  • XI to RFC processed successfully but not working

    Hello, I finally configured my RFC - XI - RFC async scenario. If I go to SXMB_MONI the message is processes OK, the mapping is OK too because I can see the output payload data in the technical routing tab. But, the destination RFC must change a DataB

  • Joikuspot free error

    I appear to be having a problem with Joikuspot wi fi free edition 3.2, I can't start it as I get a pop-up saying connection failed but the connection seems active & using 3.5G network, if I switch on Wi Fi it asks if I wish to overwrite the wi fi con

  • Problem while sending IDOC to File Senario

    Hi Experts     I am having problem while sending the Idoc from SAP R/3 to File    I have done all the setting in SAP as well in XI but while pushing IDOC    I am getting error in the transaction sm58 in SAP R/3   " <b>The service for the client 300(M

  • ICM_HTTP_CONNECTION_FAILED  Error 400

    Hello All, i have one synchronous interface on production system. it was running fine till now. But on Sunday we got around 1000 messages in SMQ2. they all are in same queue. But now same interface is running successfully....... (through another queu