Error when opening a new window using javascript - get [object] in main window Options
tkahn
Posted: Monday, May 05, 2008 6:37:45 PM

Rank: Fanatic

Joined: 11/24/2006
Posts: 322
Location: Stockholm, Sweden
In one of my page templates I have added a dynamic link to make it possible for people to share the current page on Facebook. The code looks like this:

Code:
<a href="JavaScript:window.open('http://www.facebook.com/sharer.php?u=http://www.myserver.com<?UMBRACO_MACRO macroAlias="GetNiceLink"></?UMBRACO_MACRO>&t=<?UMBRACO_GETITEM field="pageName"/>','ShareOnFacebook',
'left=50,top=50,width=500,height=400,location=0,status=0,menubar=0,toolbar=0,resizable=1');">Share this page on Facebook</a>


It's funny because the code works and does not work at the same time. It works in the sense that a new pop-up window with the proper code to share the page on facebook appears. But also the main window (the page that contained the link) reloads and is empty apart from the word [object].

I'm running Umbraco v3 and using wildcard application mapping to get friendly URL's.
The macro GetNiceLink just generates a nice link from $currentPage.

Is this a documented bug?
Is there a workaround?

/Thomas

Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
mortenbock
Posted: Monday, May 05, 2008 8:11:39 PM

Rank: Addict

Joined: 7/19/2006
Posts: 791
Location: Århus, Denmark
Is this on the public website? In that case, I don't think it is directly umbraco related.

Have you considered moving your javascript logic to the onclick event instead of using the (non standard) javascript: protocol?

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

tkahn
Posted: Monday, May 05, 2008 9:57:35 PM

Rank: Fanatic

Joined: 11/24/2006
Posts: 322
Location: Stockholm, Sweden
mortenbock wrote:
Is this on the public website? In that case, I don't think it is directly umbraco related.

Have you considered moving your javascript logic to the onclick event instead of using the (non standard) javascript: protocol?


Hi Morten!

This is on a development server that I have, but I haven't published it yet since it doesn't work.

I really do suspect that Umbraco is somehow involved in this error since the code itself is picked from other examples on the web that do work and it has always worked with the "javascript:" syntax before.

But it doesn't really matter since moving the pop-up function to the OnClick-event solved the problem! :-)

Thanks for your help!



Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.