언어 설정

Menu
Sites
Language
"Viewport target-densitydpi is not supported"

In my web app,I use window.open(url) to open my url in new window
for example:
$(".img").click(function(e){
        window.open("http://www.google.com");
 });

and in my index.html head:

<meta id="viewport_meta" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <script type="text/javascript">
        var viewport_meta = document.getElementById('viewport_meta');
        var w = window.screen.availWidth;
        var h = window.screen.availHeight;
        console.log("viewport_meta w="+w+";h="+h);
        viewport_meta.setAttribute('content', 'width=' + w + ', height=' + h + ',user-scalable=no');
    </script>

but I have get error "Viewport target-densitydpi is not supported" every time click the img,
then my web app would crash with a dialog "xxx has closed unexpectedly",
but the url has been opened with browser successfully.

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

6 댓글
Raghu Kona
Hi, You can use SystemInfo API to get screen resolution in pixels or dotsperinch, using SystemInfoDisplay property. Regards, Raghu Kona
tattoo wu
Could you tell me why can't use "window.screen.availWidth" and cause the error "Viewport target-densitydpi is not supported"? and why I get error "undefined" if I try : tizen.systeminfo.SystemInfoDisplay or tizen.SystemInfoDisplay or other sensitive first letter about "systeminfodisplay"
Raghu Kona
Tizen provides device APIs to get the properties of devices connected to the phone such as display, storage, wi-fi etc. It is recommended to use these APIs to read the values. To access the SystemInfo device API, first you need to add privileges to your application in config.xml file. Please refer to the article on SystemInfo API. https://developer.tizen.org/documentation/articles/system-information-api-guide Regards, Raghu Kona
tattoo wu
Hi, Raghu Kona I have tried the api as you said,and I have some issues: If I add feature to config.xml like this: when I debug to simulator,I get the error "## wrt-installer : xxx installation has failed - invalid widget package" then I changed the required=false,like this: it can debug,but also I get error from my index.html:"wgt/index.html (19) :[object WebAPIError]" my index.html code like this: Where am I wrong?
Raghu Kona
Hi, Apologies from my side, as the article I referred you is not the latest. It is based on the previous Tizen release. As per the 2.0 SDK, the keyword to get the display property is changed to "DISPLAY" case-sensitive. Please try using this, everything should work fine. I did n't got required= false. But you can add systeminfoi privilege to your config file by adding <tizen:privilege name="http://tizen.org/privilege/systeminfo"/> Regards, Raghu Kona
tattoo wu
Hi Raghu Kona I have tried,and it works,and I get the resolution width and height as the same as window.screen.availWidth(Height). but now I have other ideas: If I don't use any api to get resolution width and height,I set my app width=720,height=1280,the specific value. then I exe window.open("http://www.google.com"),also I get the error "xxx is closed unexpected" it means my app has crashed. and the simulator console :"Viewport target-densitydpi is not supported" so if the error is no of business with the way to get resolution or not?